From 9291fc881384201760df69dadf16fe5d8710e15a Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 28 May 2012 17:17:49 +0200 Subject: [PATCH] motionpixels: check extradata size Fixes null ptr derefernce Fixes Ticket1363 Signed-off-by: Michael Niedermayer (cherry picked from commit 50122084a6b3be06781a2b3d8ec036f2d67c32e3) Signed-off-by: Michael Niedermayer --- libavcodec/motionpixels.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c index 91f28cfe62..4af56abe37 100644 --- a/libavcodec/motionpixels.c +++ b/libavcodec/motionpixels.c @@ -53,6 +53,11 @@ static av_cold int mp_decode_init(AVCodecContext *avctx) { MotionPixelsContext *mp = avctx->priv_data; + 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);