]> git.sesse.net Git - ffmpeg/commitdiff
avformat/cdg: Fix integer overflow in duration computation
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 19 Jul 2020 14:54:28 +0000 (16:54 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 13 Sep 2020 08:40:02 +0000 (10:40 +0200)
Fixes: signed integer overflow: 8398407 * 300 cannot be represented in type 'int'
Fixes: 23914/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4702539290509312
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/cdg.c

index 05cac6e528dcb608289a2658ff0a6f30975a5c76..f933819d57421b5b427e6363b86437d3d34e3019 100644 (file)
@@ -49,7 +49,7 @@ static int read_header(AVFormatContext *s)
     if (ret < 0) {
         av_log(s, AV_LOG_WARNING, "Cannot calculate duration as file size cannot be determined\n");
     } else
-        vst->duration = (ret * vst->time_base.den) / (CDG_PACKET_SIZE * 300);
+        vst->duration = (ret * (int64_t)vst->time_base.den) / (CDG_PACKET_SIZE * 300);
 
     return 0;
 }