aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-05-11 18:40:32 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-11 21:23:49 +0200
commit94bb92e5bbe81e1ed2abf0b4fe3b0c8791ecdedf (patch)
tree6b54c07dbb500e6c86ff3643419547357978ea62
parent73e81965b7d3a93b58bcdc6825fb38c24248493d (diff)
downloadffmpeg-94bb92e5bbe81e1ed2abf0b4fe3b0c8791ecdedf.tar.gz
avformat/matroskadec: Fix handling of huge default durations
Fixes: negation of -9223372036854775808 cannot be represented in type 'int64_t' (aka 'long'); cast to an unsigned type to negate this value to itself Fixes: 33997/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-6752039691485184 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 343d950a4a8a8c32f5f7d9d4ac1fbe317cb9cc80) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/matroskadec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 7c00b5b764..20a16664c3 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2475,8 +2475,9 @@ static int matroska_parse_tracks(AVFormatContext *s)
st->need_parsing = AVSTREAM_PARSE_HEADERS;
if (track->default_duration) {
+ int div = track->default_duration <= INT64_MAX ? 1 : 2;
av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
- 1000000000, track->default_duration, 30000);
+ 1000000000 / div, track->default_duration / div, 30000);
#if FF_API_R_FRAME_RATE
if ( st->avg_frame_rate.num < st->avg_frame_rate.den * 1000LL
&& st->avg_frame_rate.num > st->avg_frame_rate.den * 5LL)