aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/matroskadec.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2019-09-04 00:50:11 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-07-03 16:14:47 +0200
commitca58c8005811b751cc09ee0ff6c98acf98cc3a1b (patch)
tree081904e59987f7ccc68ec41bbd1d1ef60ab6bcbe /libavformat/matroskadec.c
parent35557942bf51b78b2932d2c9f57ae41c0bc4b41d (diff)
downloadffmpeg-ca58c8005811b751cc09ee0ff6c98acf98cc3a1b.tar.gz
avformat/matroskadec: Fix handling gigantic durations
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> (cherry picked from commit 3714d452b894821591a2fbafdd1b8ef15abe4be6) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavformat/matroskadec.c')
-rw-r--r--libavformat/matroskadec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 161ecdcaae..f47ac31459 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -3159,7 +3159,8 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
st = track->stream;
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;