]> git.sesse.net Git - ffmpeg/commitdiff
avformat/matroskadec: Fix handling gigantic durations
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 3 Sep 2019 22:50:11 +0000 (00:50 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 15 Jun 2020 13:44:27 +0000 (15:44 +0200)
matroska_parse_block currently asserts that the duration is not equal to
AV_NOPTS_VALUE, but there is nothing that actually guarantees this. It
is easy to create (spec-compliant) files which run into this assert;
so replace it and instead cap the duration to INT64_MAX, as the duration
field of an AVPacket is an int64_t.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/matroskadec.c

index b1da40983f3aa7408ee851fca93750ee15f58112..1846b1f93ce166ee23d19fb007f8fc2810f8b04d 100644 (file)
@@ -3568,7 +3568,8 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, AVBufferRef *buf
 
     if (st->discard >= AVDISCARD_ALL)
         return res;
-    av_assert1(block_duration != AV_NOPTS_VALUE);
+    if (block_duration > INT64_MAX)
+        block_duration = INT64_MAX;
 
     block_time = sign_extend(AV_RB16(data), 16);
     data      += 2;