[FFmpeg-cvslog] avformat/matroskadec: Fix handling of huge default durations

Michael Niedermayer git at videolan.org
Tue Jul 6 22:45:47 EEST 2021


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Tue May 11 18:40:32 2021 +0200| [343d950a4a8a8c32f5f7d9d4ac1fbe317cb9cc80] | committer: Michael Niedermayer

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 at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=343d950a4a8a8c32f5f7d9d4ac1fbe317cb9cc80
---

 libavformat/matroskadec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 356a02339c..cb9e4d621f 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2805,8 +2805,9 @@ static int matroska_parse_tracks(AVFormatContext *s)
                 st->internal->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)



More information about the ffmpeg-cvslog mailing list