[FFmpeg-cvslog] mjpegb: don't return 0 at the end of frame decoding.

Ronald S. Bultje git at videolan.org
Sun Feb 19 02:19:07 CET 2012


ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Fri Feb 17 16:27:36 2012 -0800| [74699ac8c8b562e9f8d26e21482b89585365774a] | committer: Ronald S. Bultje

mjpegb: don't return 0 at the end of frame decoding.

Return 0 indicates "please return the same data again", i.e. it causes
an infinite loop. Instead, return that we consumed the buffer if we
finished decoding succesfully, or return an error if an error occurred.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=74699ac8c8b562e9f8d26e21482b89585365774a
---

 libavcodec/mjpegbdec.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mjpegbdec.c b/libavcodec/mjpegbdec.c
index c89a5bd..10c5add 100644
--- a/libavcodec/mjpegbdec.c
+++ b/libavcodec/mjpegbdec.c
@@ -69,7 +69,7 @@ read_header:
     if (get_bits_long(&hgb, 32) != MKBETAG('m','j','p','g'))
     {
         av_log(avctx, AV_LOG_WARNING, "not mjpeg-b (bad fourcc)\n");
-        return 0;
+        return AVERROR_INVALIDDATA;
     }
 
     field_size = get_bits_long(&hgb, 32); /* field size */
@@ -149,7 +149,7 @@ read_header:
         picture->quality*= FF_QP2LAMBDA;
     }
 
-    return buf_ptr - buf;
+    return buf_size;
 }
 
 AVCodec ff_mjpegb_decoder = {



More information about the ffmpeg-cvslog mailing list