1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avformat/dhav: Limit get_duration() iterations

Fixes: Timeout
Fixes: 39971/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5756969890217984
Fixes: 39977/clusterfuzz-testcase-minimized-ffmpeg_dem_DHAV_fuzzer-5327123053674496

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 2021-10-17 15:15:08 +02:00
parent 866ad2e952
commit 97c3053d59

View File

@ -234,12 +234,13 @@ static int64_t get_duration(AVFormatContext *s)
int64_t start_pos = avio_tell(s->pb);
int64_t start = 0, end = 0;
struct tm timeinfo;
int max_interations = 100000;
if (!s->pb->seekable)
return 0;
avio_seek(s->pb, avio_size(s->pb) - 8, SEEK_SET);
while (avio_tell(s->pb) > 12) {
while (avio_tell(s->pb) > 12 && max_interations--) {
if (avio_rl32(s->pb) == MKTAG('d','h','a','v')) {
int seek_back = avio_rl32(s->pb);