avformat/vqf: Check len for COMM chunks

Fixes: Infinite loop
Fixes: 26696/clusterfuzz-testcase-minimized-ffmpeg_dem_VQF_fuzzer-5648269168082944

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit a834af133b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2020-11-01 20:20:02 +01:00
parent 6718c814aa
commit 2f16247c99
1 changed files with 3 additions and 0 deletions

View File

@ -132,6 +132,9 @@ static int vqf_read_header(AVFormatContext *s)
switch(chunk_tag){ switch(chunk_tag){
case MKTAG('C','O','M','M'): case MKTAG('C','O','M','M'):
if (len < 12)
return AVERROR_INVALIDDATA;
avio_read(s->pb, comm_chunk, 12); avio_read(s->pb, comm_chunk, 12);
st->codecpar->channels = AV_RB32(comm_chunk ) + 1; st->codecpar->channels = AV_RB32(comm_chunk ) + 1;
read_bitrate = AV_RB32(comm_chunk + 4); read_bitrate = AV_RB32(comm_chunk + 4);