diff mbox series

[FFmpeg-devel,5/7] avformat/bfi: check nframes

Message ID 20210423175056.24019-5-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/7] avformat/asfdec_o: shrink extradata to the initialized size
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer April 23, 2021, 5:50 p.m. UTC
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>
---
 libavformat/bfi.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/libavformat/bfi.c b/libavformat/bfi.c
index 2dab986f3a..f9e0bb2e30 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);