[FFmpeg-cvslog] avformat/vividas: Check buffer size before allocation

Michael Niedermayer git at videolan.org
Sun Aug 4 22:19:16 EEST 2019


ffmpeg | branch: release/4.2 | Michael Niedermayer <michael at niedermayer.cc> | Sat Jul 13 19:57:21 2019 +0200| [c9322598f4e9d45d5a1c2451e056c428213907b6] | committer: Michael Niedermayer

avformat/vividas: Check buffer size before allocation

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>
(cherry picked from commit c3ef24d9baf63f8c8794dfb2ef7192a64b586526)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c9322598f4e9d45d5a1c2451e056c428213907b6
---

 libavformat/vividas.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/vividas.c b/libavformat/vividas.c
index c0d39f0a6f..184d24f374 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;



More information about the ffmpeg-cvslog mailing list