[FFmpeg-cvslog] avcodec/mjpegbdec: Skip SOS on AVDISCARD_ALL as does mjpeg
Michael Niedermayer
git at videolan.org
Wed Sep 8 22:44:12 EEST 2021
ffmpeg | branch: release/4.4 | Michael Niedermayer <michael at niedermayer.cc> | Sun Aug 22 21:57:28 2021 +0200| [fa4ac6b43a48f6cb047792fed349bc1ea6952c36] | committer: Michael Niedermayer
avcodec/mjpegbdec: Skip SOS on AVDISCARD_ALL as does mjpeg
Fixes: NULL pointer dereference
Fixes: 36342/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEGB_fuzzer-4579188072906752
Fixes: 36344/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEGB_fuzzer-5049579300061184
Fixes: 36345/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEGB_fuzzer-5301149845553152
Fixes: 36374/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEGB_fuzzer-6056312352931840
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 104a8399ae96f022a3662bd67668ad07e53e3093)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fa4ac6b43a48f6cb047792fed349bc1ea6952c36
---
libavcodec/mjpegbdec.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/libavcodec/mjpegbdec.c b/libavcodec/mjpegbdec.c
index 7666674908..19875a2ddb 100644
--- a/libavcodec/mjpegbdec.c
+++ b/libavcodec/mjpegbdec.c
@@ -119,9 +119,13 @@ read_header:
8 * FFMIN(field_size, buf_end - buf_ptr - sos_offs));
s->mjpb_skiptosod = (sod_offs - sos_offs - show_bits(&s->gb, 16));
s->start_code = SOS;
- ret = ff_mjpeg_decode_sos(s, NULL, 0, NULL);
- if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
- return ret;
+ if (avctx->skip_frame == AVDISCARD_ALL) {
+ skip_bits(&s->gb, get_bits_left(&s->gb));
+ } else {
+ ret = ff_mjpeg_decode_sos(s, NULL, 0, NULL);
+ if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
+ return ret;
+ }
}
if (s->interlaced) {
More information about the ffmpeg-cvslog
mailing list