Commit 868ab9f818 for ffmpeg
commit 868ab9f81852534241057ba31f1c8418b6b58008
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Mon Nov 16 06:56:38 2026 +0100
avformat/rpl: check the audio size of a chunk before using it
Signed integer overflow Replicated through UnModified FFmpeg with UBSAN
Fixes: signed integer overflow: 4133067176707077211 * 8 cannot be represented in type 'int64_t' (aka 'long')
Fixes: 578084947/clusterfuzz-testcase-minimized-ffmpeg_dem_RPL_fuzzer-6427797955608576
Fixes: dqnVagTmi5NZ
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
diff --git a/libavformat/rpl.c b/libavformat/rpl.c
index 06e3f354fc..d3aa257e6b 100644
--- a/libavformat/rpl.c
+++ b/libavformat/rpl.c
@@ -301,14 +301,14 @@ static int rpl_read_header(AVFormatContext *s)
error = -1;
continue;
}
+ if (total_audio_size/8 + (uint64_t)audio_size >= INT64_MAX/8)
+ return AVERROR_INVALIDDATA;
if (vst)
av_add_index_entry(vst, offset, i * rpl->frames_per_chunk,
video_size, rpl->frames_per_chunk, 0);
if (ast)
av_add_index_entry(ast, offset + video_size, total_audio_size,
audio_size, audio_size * 8, 0);
- if (total_audio_size/8 + (uint64_t)audio_size >= INT64_MAX/8)
- return AVERROR_INVALIDDATA;
total_audio_size += audio_size * 8;
}