summaryrefslogtreecommitdiff
path: root/libavcodec/iff.c
diff options
context:
space:
mode:
authorSebastian Vater <cdgs.basty@googlemail.com>2010-05-13 15:33:36 +0000
committerRonald S. Bultje <rsbultje@gmail.com>2010-05-13 15:33:36 +0000
commitebcf7c3227906382205141beb2d0467f245472d1 (patch)
treeb34d3befe1a08d71da7d51f623534ee6e9fe61b3 /libavcodec/iff.c
parent2f955ea41b804c0804f71d27a0bba13e59988726 (diff)
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
Diffstat (limited to 'libavcodec/iff.c')
-rw-r--r--libavcodec/iff.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index 2b3648bc8a..019af4dbfe 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -123,10 +123,8 @@ int ff_cmap_read_palette(AVCodecContext *avctx, uint32_t *pal)
}
count = 1 << avctx->bits_per_coded_sample;
- if (avctx->extradata_size < count * 3) {
- av_log(avctx, AV_LOG_ERROR, "palette data underflow\n");
- return AVERROR_INVALIDDATA;
- }
+ // If extradata is smaller than actually needed, fill the remaining with black.
+ count = FFMIN(avctx->extradata_size / 3, count);
for (i=0; i < count; i++) {
pal[i] = 0xFF000000 | AV_RB24( avctx->extradata + i*3 );
}