aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-10-17 15:15:08 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-11-14 17:51:35 +0100
commit97c3053d59f30f84b30efcc73ccf1b2e84b89006 (patch)
tree4e64226ab3769bba12c9c105a76a288d19fd3863 /libavformat
parent866ad2e95262606b194cb2e79ce8a7e63c32ce06 (diff)
downloadffmpeg-97c3053d59f30f84b30efcc73ccf1b2e84b89006.tar.gz
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>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/dhav.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/dhav.c b/libavformat/dhav.c
index b6bb25204c..6c1cdde32c 100644
--- a/libavformat/dhav.c
+++ b/libavformat/dhav.c
@@ -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);