Commit c30e4186f7 for ffmpeg
commit c30e4186f701894d5204ddba5187bf928928bc8f
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Mon Nov 16 06:56:38 2026 +0100
avformat/rpl: reject chunks whose video data ends beyond INT64_MAX
Chunks with a negative video size are rejected too.
Signed integer overflow Replicated through UnModified FFmpeg with UBSAN
Found during triage of the OSS-Fuzz issue 578084947
Fixes: signed integer overflow: 9223372036854775807 + 8 cannot be represented in type 'int64_t' (aka 'long')
Fixes: oYqfrDQlip85/rpl-offset-overflow.rpl
Fixes: oYqfrDQlip85
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
diff --git a/libavformat/rpl.c b/libavformat/rpl.c
index d3aa257e6b..0b3cd07ad3 100644
--- a/libavformat/rpl.c
+++ b/libavformat/rpl.c
@@ -301,7 +301,8 @@ static int rpl_read_header(AVFormatContext *s)
error = -1;
continue;
}
- if (total_audio_size/8 + (uint64_t)audio_size >= INT64_MAX/8)
+ if (video_size < 0 || offset > INT64_MAX - video_size ||
+ 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,