mjpegbdec: dont return a picture when there is no picture.
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 9 Nov 2012 11:43:51 +0000 (12:43 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 9 Nov 2012 11:44:26 +0000 (12:44 +0100)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/mjpegbdec.c

index 77f23f2..796ef84 100644 (file)
@@ -136,6 +136,11 @@ read_header:
 
     //XXX FIXME factorize, this looks very similar to the EOI code
 
+    if(!s->got_picture) {
+        av_log(avctx, AV_LOG_WARNING, "no picture\n");
+        return buf_size;
+    }
+
     *picture= *s->picture_ptr;
     *data_size = sizeof(AVFrame);