diff options
author | Paul B Mahol <onemda@gmail.com> | 2012-05-30 07:50:32 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-06-09 21:07:05 +0200 |
commit | c761e144f63735d9ad31dcd8971139837523acc3 (patch) | |
tree | 90f0cc70c9a5620fa6473ec0d5fd7c636b50da66 | |
parent | b3e5c8de6a46dd5acb510147df22818d8a971607 (diff) | |
download | ffmpeg-c761e144f63735d9ad31dcd8971139837523acc3.tar.gz |
iff: check if there is extradata
Fixes #1368.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit 8f61526978697e51d3b9e61ea84daf13c42717af)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/iff.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/iff.c b/libavcodec/iff.c index 9e74365f11..622bd4f020 100644 --- a/libavcodec/iff.c +++ b/libavcodec/iff.c @@ -285,7 +285,12 @@ static av_cold int decode_init(AVCodecContext *avctx) int err; if (avctx->bits_per_coded_sample <= 8) { - int palette_size = avctx->extradata_size - AV_RB16(avctx->extradata); + int palette_size; + + if (avctx->extradata_size >= 2) + palette_size = avctx->extradata_size - AV_RB16(avctx->extradata); + else + palette_size = 0; avctx->pix_fmt = (avctx->bits_per_coded_sample < 8) || (avctx->extradata_size >= 2 && palette_size) ? PIX_FMT_PAL8 : PIX_FMT_GRAY8; } else if (avctx->bits_per_coded_sample <= 32) { |