1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-02-04 06:08:26 +02:00

avcodec/mxpegdec: fix SOF counting

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>
(cherry picked from commit 401495def62638a205569cac0f7861c7faba4d18)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2020-12-03 00:31:07 +01:00
parent d75428c9b7
commit 4a2738c68b

View File

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