avformat/avr: Check sample rate

Fixes: 54979/clusterfuzz-testcase-minimized-ffmpeg_dem_AVR_fuzzer-6681035461230592
Fixes: Timeout

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 32556fa62b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2023-07-23 01:46:20 +02:00
parent 53e3119d0f
commit 5a88bf8ee7
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
1 changed files with 3 additions and 0 deletions

View File

@ -70,6 +70,9 @@ static int avr_read_header(AVFormatContext *s)
avio_skip(s->pb, 1); // replay speed avio_skip(s->pb, 1); // replay speed
st->codecpar->sample_rate = avio_rb24(s->pb); st->codecpar->sample_rate = avio_rb24(s->pb);
if (st->codecpar->sample_rate == 0)
return AVERROR_INVALIDDATA;
avio_skip(s->pb, 4 * 3); avio_skip(s->pb, 4 * 3);
avio_skip(s->pb, 2 * 3); avio_skip(s->pb, 2 * 3);
avio_skip(s->pb, 20); avio_skip(s->pb, 20);