avformat/concatdec: Check user_duration sum

Fixes: 62276/clusterfuzz-testcase-minimized-ffmpeg_dem_CONCAT_fuzzer-6434245599690752
Fixes: signed integer overflow: 9223372026773000000 + 22337000000 cannot be represented in type 'long'

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2024-03-26 00:16:39 +01:00
parent 1eb8cbd09c
commit 007486058c
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
1 changed files with 2 additions and 0 deletions

View File

@ -679,6 +679,8 @@ static int concat_read_header(AVFormatContext *avf)
cat->files[i].user_duration = cat->files[i].outpoint - cat->files[i].inpoint;
}
cat->files[i].duration = cat->files[i].user_duration;
if (time + (uint64_t)cat->files[i].user_duration > INT64_MAX)
return AVERROR_INVALIDDATA;
time += cat->files[i].user_duration;
}
if (i == cat->nb_files) {