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);