avformat/vividas: Check sample_rate

Fixes: Assertion c > 0 failed at libavutil/mathematics.c
Fixes: 27001/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-5726041328582656
Fixes: 27453/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-5716060384526336

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 2020-11-10 22:36:25 +01:00
parent b29d351f97
commit b1bced5433
1 changed files with 2 additions and 0 deletions

View File

@ -373,6 +373,8 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *
avio_rl16(pb); //codec_subid avio_rl16(pb); //codec_subid
st->codecpar->channels = avio_rl16(pb); // channels st->codecpar->channels = avio_rl16(pb); // channels
st->codecpar->sample_rate = avio_rl32(pb); // sample_rate st->codecpar->sample_rate = avio_rl32(pb); // sample_rate
if (st->codecpar->sample_rate <= 0)
return AVERROR_INVALIDDATA;
avio_seek(pb, 10, SEEK_CUR); // data_1 avio_seek(pb, 10, SEEK_CUR); // data_1
q = avio_r8(pb); q = avio_r8(pb);
avio_seek(pb, q, SEEK_CUR); // data_2 avio_seek(pb, q, SEEK_CUR); // data_2