Commit ebcf7c32 authored by Sebastian Vater's avatar Sebastian Vater Committed by Ronald S. Bultje

Handle palette underflows, fill remaining space with black (zero) data.

Patch by Sebastian Vater <cdgs basty googlemail com>.

Originally committed as revision 23111 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 2f955ea4
...@@ -123,10 +123,8 @@ int ff_cmap_read_palette(AVCodecContext *avctx, uint32_t *pal) ...@@ -123,10 +123,8 @@ int ff_cmap_read_palette(AVCodecContext *avctx, uint32_t *pal)
} }
count = 1 << avctx->bits_per_coded_sample; count = 1 << avctx->bits_per_coded_sample;
if (avctx->extradata_size < count * 3) { // If extradata is smaller than actually needed, fill the remaining with black.
av_log(avctx, AV_LOG_ERROR, "palette data underflow\n"); count = FFMIN(avctx->extradata_size / 3, count);
return AVERROR_INVALIDDATA;
}
for (i=0; i < count; i++) { for (i=0; i < count; i++) {
pal[i] = 0xFF000000 | AV_RB24( avctx->extradata + i*3 ); pal[i] = 0xFF000000 | AV_RB24( avctx->extradata + i*3 );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment