v410dec: Check for sufficient input data. Fixes crash
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 28 Dec 2011 20:04:44 +0000 (15:04 -0500)
committerRonald S. Bultje <rsbultje@gmail.com>
Wed, 28 Dec 2011 20:47:36 +0000 (12:47 -0800)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
libavcodec/v410dec.c

index 71cbe0b..54c9595 100644 (file)
@@ -55,6 +55,11 @@ static int v410_decode_frame(AVCodecContext *avctx, void *data,
     if (pic->data[0])
         avctx->release_buffer(avctx, pic);
 
+    if (avpkt->size < 4 * avctx->height * avctx->width) {
+        av_log(avctx, AV_LOG_ERROR, "Insufficient input data.\n");
+        return AVERROR(EINVAL);
+    }
+
     pic->reference = 0;
 
     if (avctx->get_buffer(avctx, pic) < 0) {