This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 2defa3985ac653099d5568f2679f35b5e9c427b4 Author: Michael Niedermayer <[email protected]> AuthorDate: Sat Oct 10 04:57:53 2026 +0200 Commit: michaelni <[email protected]> CommitDate: Mon Oct 12 23:55:55 2026 +0000 avcodec/mjpegdec: handle THP restart intervals in all scan types Timeout Replicated through API Fixes: Timeout Fixes: 565276248/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THP_fuzzer-6001511570931712 Fixes: Z70IPpK3idWD Regression since: 5672c410a6adc2764791e7fcc0e34acea07ac263 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <[email protected]> --- libavcodec/mjpegdec.c | 17 +++-------------- libavcodec/mjpegdec.h | 5 +++++ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 3dc8662abb..cbb7268ed9 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -1477,20 +1477,9 @@ next_field: const int copy_mb = mb_bitmask && !get_bits1(&mb_bitmask_gb); int restart; - if (s->avctx->codec_id == AV_CODEC_ID_THP) { - if (s->restart_count < 0) { - ret = ff_mjpeg_unescape_sos(s); - if (ret < 0) - return ret; - } - restart = ff_mjpeg_should_restart(s); - if (restart) - align_get_bits(&s->gb); - } else { - ret = ff_mjpeg_handle_restart(s, &restart); - if (ret < 0) - return ret; - } + ret = ff_mjpeg_handle_restart(s, &restart); + if (ret < 0) + return ret; if (restart) { for (i = 0; i < nb_components; i++) s->last_dc[i] = (4 << s->bits); diff --git a/libavcodec/mjpegdec.h b/libavcodec/mjpegdec.h index 5ba96eaa3e..9162de851f 100644 --- a/libavcodec/mjpegdec.h +++ b/libavcodec/mjpegdec.h @@ -217,8 +217,13 @@ static inline int ff_mjpeg_should_restart(MJpegDecodeContext *s) static inline int ff_mjpeg_handle_restart(MJpegDecodeContext *s, int *restart) { + int first = s->restart_count < 0; *restart = ff_mjpeg_should_restart(s); if (*restart) { + if (s->avctx->codec_id == AV_CODEC_ID_THP && !first) { + align_get_bits(&s->gb); + return 0; + } int ret = ff_mjpeg_unescape_sos(s); if (ret < 0) return ret; -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
