diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-01-25 23:55:21 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-01-25 23:56:09 +0100 |
commit | 01e5e97026cf0b344abafca22b0336a2c58b2a33 (patch) | |
tree | 807365a7a7a473e6e2dd13e748418bc833d0e219 | |
parent | dd453f197c136aa6ee45bb1e9d2a1d65e69c9fcc (diff) | |
download | ffmpeg-01e5e97026cf0b344abafca22b0336a2c58b2a33.tar.gz |
mjpegbdec: Fix incorrect bitstream buffer size.
Fixes CVE-2011-3947
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/mjpegbdec.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/libavcodec/mjpegbdec.c b/libavcodec/mjpegbdec.c index 75f3d50b76..c8b1452e9e 100644 --- a/libavcodec/mjpegbdec.c +++ b/libavcodec/mjpegbdec.c @@ -111,8 +111,7 @@ read_header: av_log(avctx, AV_LOG_DEBUG, "sod offs: 0x%x\n", sod_offs); if (sos_offs) { -// init_get_bits(&s->gb, buf+sos_offs, (buf_end - (buf+sos_offs))*8); - init_get_bits(&s->gb, buf_ptr+sos_offs, field_size*8); + init_get_bits(&s->gb, buf_ptr+sos_offs, FFMIN(field_size, buf_end - (buf_ptr+sos_offs))*8); s->mjpb_skiptosod = (sod_offs - sos_offs - show_bits(&s->gb, 16)); s->start_code = SOS; if (ff_mjpeg_decode_sos(s, NULL, NULL) < 0 && |