1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avformat/rpl: Check for number_of_chunks overflow

Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int32_t' (aka 'int')
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_RPL_fuzzer-6086131095830528

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 b3c973acbe)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2023-09-30 21:14:28 +02:00
parent a1a6819e93
commit 71f3d2856b
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -265,6 +265,9 @@ static int rpl_read_header(AVFormatContext *s)
"Video stream will be broken!\n", av_fourcc2str(vst->codecpar->codec_tag));
number_of_chunks = read_line_and_int(pb, &error); // number of chunks in the file
if (number_of_chunks == INT_MAX)
return AVERROR_INVALIDDATA;
// The number in the header is actually the index of the last chunk.
number_of_chunks++;