aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-04-23 19:33:58 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-09 13:54:52 +0200
commit8cacdaf8197222a04ce40c37b2f56c4516cb1a92 (patch)
tree0d7b076d694f8c18eebce7e44ebedcb3bf0889d5
parenta7c6df6df0ef1b5fdc92ebb395ac11b82b66eb6f (diff)
downloadffmpeg-8cacdaf8197222a04ce40c37b2f56c4516cb1a92.tar.gz
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>
-rw-r--r--libavformat/bfi.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/bfi.c b/libavformat/bfi.c
index 9d88533acf..f32a2cf8ce 100644
--- a/libavformat/bfi.c
+++ b/libavformat/bfi.c
@@ -73,6 +73,8 @@ static int bfi_read_header(AVFormatContext * s)
return AVERROR_INVALIDDATA;
bfi->nframes = avio_rl32(pb);
+ if (bfi->nframes < 0)
+ return AVERROR_INVALIDDATA;
avio_rl32(pb);
avio_rl32(pb);
avio_rl32(pb);