avformat/cdg: Fix integer overflow in duration computation

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>
(cherry picked from commit aa8935b395)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2020-07-19 16:54:28 +02:00
parent 3a876338f1
commit 1054819802
1 changed files with 1 additions and 1 deletions

View File

@ -49,7 +49,7 @@ static int read_header(AVFormatContext *s)
if (ret < 0) { if (ret < 0) {
av_log(s, AV_LOG_WARNING, "Cannot calculate duration as file size cannot be determined\n"); av_log(s, AV_LOG_WARNING, "Cannot calculate duration as file size cannot be determined\n");
} else } 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; return 0;
} }