diff options
author | Ronald S. Bultje <[email protected]> | 2012-02-17 16:27:36 -0800 |
---|---|---|
committer | Reinhard Tartler <[email protected]> | 2012-04-01 18:33:26 +0200 |
commit | 33149928edef047fb6391cf8a84602a213c62921 (patch) | |
tree | 31f794e7b8369191b5eb44fdac2c8e3cd92372ff | |
parent | 9a331217b00be566e8cc7afcd4df916b43e1756b (diff) |
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: [email protected]
(cherry picked from commit 74699ac8c8b562e9f8d26e21482b89585365774a)
Signed-off-by: Anton Khirnov <[email protected]>
Signed-off-by: Reinhard Tartler <[email protected]>
-rw-r--r-- | libavcodec/mjpegbdec.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/mjpegbdec.c b/libavcodec/mjpegbdec.c index 837304ea74..454ba6ffc9 100644 --- a/libavcodec/mjpegbdec.c +++ b/libavcodec/mjpegbdec.c @@ -66,7 +66,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 */ @@ -142,7 +142,7 @@ read_header: picture->quality*= FF_QP2LAMBDA; } - return buf_ptr - buf; + return buf_size; } AVCodec ff_mjpegb_decoder = { |