summaryrefslogtreecommitdiff
path: root/libavcodec/mjpegbdec.c
diff options
context:
space:
mode:
authorDustin Brody <libav@parsoma.net>2011-08-11 11:16:09 -0400
committerRonald S. Bultje <rsbultje@gmail.com>2011-08-11 16:02:18 -0700
commit21d70372341d0e7a1c5ac34c4522850f40c503d5 (patch)
treea39f743560891ea212392233d5d9d63948639df6 /libavcodec/mjpegbdec.c
parentbac3ab13ea6a9dd8853e79ef3eacf51d234c8774 (diff)
downloadffmpeg-21d70372341d0e7a1c5ac34c4522850f40c503d5.tar.gz
mjpeg: propagate decode errors from ff_mjpeg_decode_sos and ff_mjpeg_decode_dqt
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavcodec/mjpegbdec.c')
-rw-r--r--libavcodec/mjpegbdec.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/mjpegbdec.c b/libavcodec/mjpegbdec.c
index be5d853624..a9f94f1c5b 100644
--- a/libavcodec/mjpegbdec.c
+++ b/libavcodec/mjpegbdec.c
@@ -81,7 +81,9 @@ read_header:
{
init_get_bits(&s->gb, buf_ptr+dqt_offs, (buf_end - (buf_ptr+dqt_offs))*8);
s->start_code = DQT;
- ff_mjpeg_decode_dqt(s);
+ if (ff_mjpeg_decode_dqt(s) < 0 &&
+ avctx->error_recognition >= FF_ER_EXPLODE)
+ return AVERROR_INVALIDDATA;
}
dht_offs = read_offs(avctx, &hgb, buf_end - buf_ptr, "dht is %d and size is %d\n");
@@ -113,7 +115,9 @@ read_header:
init_get_bits(&s->gb, buf_ptr+sos_offs, field_size*8);
s->mjpb_skiptosod = (sod_offs - sos_offs - show_bits(&s->gb, 16));
s->start_code = SOS;
- ff_mjpeg_decode_sos(s, NULL, NULL);
+ if (ff_mjpeg_decode_sos(s, NULL, NULL) < 0 &&
+ avctx->error_recognition >= FF_ER_EXPLODE)
+ return AVERROR_INVALIDDATA;
}
if (s->interlaced) {