[FFmpeg-cvslog] avcodec/mjpegdec: Check for bits left in mjpeg_decode_scan_progressive_ac()
Michael Niedermayer
git at videolan.org
Wed Sep 8 22:44:10 EEST 2021
ffmpeg | branch: release/4.4 | Michael Niedermayer <michael at niedermayer.cc> | Sun Aug 22 20:47:00 2021 +0200| [af8de920b7bdf6f5dfb34d3fd2e31e24fe50fb60] | committer: Michael Niedermayer
avcodec/mjpegdec: Check for bits left in mjpeg_decode_scan_progressive_ac()
Fixes: Timeout
Fixes: 36262/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEGLS_fuzzer-4969052454912000
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 909faca929cf30dcd439fa33479177e76fb5121d)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=af8de920b7bdf6f5dfb34d3fd2e31e24fe50fb60
---
libavcodec/mjpegdec.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 2df6caa440..afb117cfc6 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1573,6 +1573,9 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss,
else
ret = decode_block_progressive(s, *block, last_nnz, s->ac_index[0],
quant_matrix, ss, se, Al, &EOBRUN);
+
+ if (ret >= 0 && get_bits_left(&s->gb) < 0)
+ ret = AVERROR_INVALIDDATA;
if (ret < 0) {
av_log(s->avctx, AV_LOG_ERROR,
"error y=%d x=%d\n", mb_y, mb_x);
More information about the ffmpeg-cvslog
mailing list