1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-29 22:00:58 +02:00

avformat/bfi: check nframes

Fixes: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'
Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_BFI_fuzzer-6737028768202752

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 b4e77dfca1c2970446f79277034d8e60c3fe3f4e)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2021-04-23 19:33:58 +02:00
parent 2ec7e09a0c
commit e5a7c4ce50

View File

@ -73,6 +73,8 @@ static int bfi_read_header(AVFormatContext * s)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
bfi->nframes = avio_rl32(pb); bfi->nframes = avio_rl32(pb);
if (bfi->nframes < 0)
return AVERROR_INVALIDDATA;
avio_rl32(pb); avio_rl32(pb);
avio_rl32(pb); avio_rl32(pb);
avio_rl32(pb); avio_rl32(pb);