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@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2019-07-13 19:57:21 +02:00
parent 8e41675e18
commit c3ef24d9ba
1 changed files with 3 additions and 0 deletions

View File

@ -251,6 +251,9 @@ static uint8_t *read_sb_block(AVIOContext *src, unsigned *size,
*key = tmpkey; *key = tmpkey;
} }
if (n < 8)
return NULL;
buf = av_malloc(n); buf = av_malloc(n);
if (!buf) if (!buf)
return NULL; return NULL;