Browse Source

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@libav.org
(cherry picked from commit 74699ac8c8)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
tags/n0.8.11
Ronald S. Bultje Reinhard Tartler 14 years ago
parent
commit
33149928ed
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      libavcodec/mjpegbdec.c

+ 2
- 2
libavcodec/mjpegbdec.c View File

@@ -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 = {


Loading…
Cancel
Save