motionpixels: check extradata size
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 28 May 2012 15:17:49 +0000 (17:17 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 9 Jun 2012 18:38:22 +0000 (20:38 +0200)
Fixes null ptr derefernce
Fixes Ticket1363

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 50122084a6b3be06781a2b3d8ec036f2d67c32e3)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/motionpixels.c

index 508a0aa..6b07805 100644 (file)
@@ -55,6 +55,11 @@ static av_cold int mp_decode_init(AVCodecContext *avctx)
     int w4 = (avctx->width  + 3) & ~3;
     int h4 = (avctx->height + 3) & ~3;
 
+    if(avctx->extradata_size < 2){
+        av_log(avctx, AV_LOG_ERROR, "extradata too small\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     motionpixels_tableinit();
     mp->avctx = avctx;
     dsputil_init(&mp->dsp, avctx);