]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/mxpegdec: fix SOF counting
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 2 Dec 2020 23:31:07 +0000 (00:31 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 4 Feb 2021 16:26:06 +0000 (17:26 +0100)
Fixes: Timeout (>10sec -> 15ms)
Fixes: 27652/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MXPEG_fuzzer-5125920868007936
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/mxpegdec.c

index 725e435118d1669618d6629542d7e5b347e70c13..763ce5871dfeef4ae050a4d934b4eee3551a2603 100644 (file)
@@ -245,16 +245,17 @@ static int mxpeg_decode_frame(AVCodecContext *avctx,
                            "Multiple SOF in a frame\n");
                     return AVERROR_INVALIDDATA;
                 }
-                s->got_sof_data = 0;
                 ret = ff_mjpeg_decode_sof(jpg);
                 if (ret < 0) {
                     av_log(avctx, AV_LOG_ERROR,
                            "SOF data decode error\n");
+                    s->got_sof_data = 0;
                     return ret;
                 }
                 if (jpg->interlaced) {
                     av_log(avctx, AV_LOG_ERROR,
                            "Interlaced mode not supported in MxPEG\n");
+                    s->got_sof_data = 0;
                     return AVERROR(EINVAL);
                 }
                 s->got_sof_data ++;