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

Submitted by Michael Niedermayer on July 13, 2019, 8:25 p.m.

Details

Message ID 20190713202506.14871-3-michael@niedermayer.cc
State Accepted
Commit c3ef24d9baf63f8c8794dfb2ef7192a64b586526
Headers show

Commit Message

Michael Niedermayer July 13, 2019, 8:25 p.m.
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@niedermayer.cc>
---
 libavformat/vividas.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Michael Niedermayer Aug. 3, 2019, 3:15 p.m.
On Sat, Jul 13, 2019 at 10:25:03PM +0200, Michael Niedermayer wrote:
> 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@niedermayer.cc>
> ---
>  libavformat/vividas.c | 3 +++
>  1 file changed, 3 insertions(+)

will apply

[...]

Patch hide | download patch | download mbox

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;