[FFmpeg-cvslog] iff: check if there is extradata
Paul B Mahol
git at videolan.org
Sat Jun 9 21:18:03 CEST 2012
ffmpeg | branch: release/0.7 | Paul B Mahol <onemda at gmail.com> | Wed May 30 07:50:32 2012 +0000| [c761e144f63735d9ad31dcd8971139837523acc3] | committer: Michael Niedermayer
iff: check if there is extradata
Fixes #1368.
Signed-off-by: Paul B Mahol <onemda at gmail.com>
(cherry picked from commit 8f61526978697e51d3b9e61ea84daf13c42717af)
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c761e144f63735d9ad31dcd8971139837523acc3
---
libavcodec/iff.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index 9e74365..622bd4f 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) {
More information about the ffmpeg-cvslog
mailing list