[FFmpeg-devel] [PATCH 3/6] avformat/vividas: Check buffer size before allocation

Michael Niedermayer michael at niedermayer.cc
Sat Jul 13 23:25:03 EEST 2019


Fixes: out of array access
Fixes: 15365/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5716153105645568

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavformat/vividas.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/vividas.c b/libavformat/vividas.c
index 830e318645..2564a163cb 100644
--- a/libavformat/vividas.c
+++ b/libavformat/vividas.c
@@ -251,6 +251,9 @@ static uint8_t *read_sb_block(AVIOContext *src, unsigned *size,
         *key = tmpkey;
     }
 
+    if (n < 8)
+        return NULL;
+
     buf = av_malloc(n);
     if (!buf)
         return NULL;
-- 
2.22.0



More information about the ffmpeg-devel mailing list