avcodec/h264_parser: Check remaining input length in loop in scan_mmco_reset()

Fixes: read of uninitialized memory
Fixes: 476177761/clusterfuzz-testcase-minimized-ffmpeg_dem_H264_fuzzer-6400884824408064

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 73681f888d)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer
2026-02-06 22:05:06 +01:00
parent 4aab8b6242
commit 4dffdd1a92
+3
View File
@@ -223,6 +223,9 @@ static int scan_mmco_reset(AVCodecParserContext *s, GetBitContext *gb,
if (get_bits1(gb)) { // adaptive_ref_pic_marking_mode_flag
int i;
for (i = 0; i < H264_MAX_MMCO_COUNT; i++) {
if (get_bits_left(gb) < 1)
return AVERROR_INVALIDDATA;
MMCOOpcode opcode = get_ue_golomb_31(gb);
if (opcode > (unsigned) MMCO_LONG) {
av_log(logctx, AV_LOG_ERROR,