]> git.sesse.net Git - ffmpeg/commitdiff
avformat/dxa: Use av_rescale() for duration computation
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 2 Sep 2020 21:13:00 +0000 (23:13 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 2 Oct 2020 12:59:53 +0000 (14:59 +0200)
Fixes: signed integer overflow: 8224000000 * 1629552639 cannot be represented in type 'long'
Fixes: 24908/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4658478506049536
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/dxa.c

index 27fa6afb6a0cab720a8ad25c335000033df2c6ef..909c5ba2bafb8db4b25eed7b897def64f5ddd079 100644 (file)
@@ -143,7 +143,7 @@ static int dxa_read_header(AVFormatContext *s)
     c->readvid = !c->has_sound;
     c->vidpos  = avio_tell(pb);
     s->start_time = 0;
-    s->duration = (int64_t)c->frames * AV_TIME_BASE * num / den;
+    s->duration = av_rescale(c->frames, AV_TIME_BASE * (int64_t)num, den);
     av_log(s, AV_LOG_DEBUG, "%d frame(s)\n",c->frames);
 
     return 0;