diff mbox series

[FFmpeg-devel,4/6] avformat/cdg: Fix integer overflow in duration computation

Message ID 20200719174218.30659-4-michael@niedermayer.cc
State Accepted
Commit aa8935b395162f8438d1f055e671e92685ed1586
Headers show
Series [FFmpeg-devel,1/6] avformat/wc3movie: Move wc3_read_close() up
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Michael Niedermayer July 19, 2020, 5:42 p.m. UTC
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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Sept. 12, 2020, 10:56 p.m. UTC | #1
On Sun, Jul 19, 2020 at 07:42:16PM +0200, Michael Niedermayer wrote:
> 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 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/cdg.c b/libavformat/cdg.c
index 05cac6e528..f933819d57 100644
--- a/libavformat/cdg.c
+++ b/libavformat/cdg.c
@@ -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;
 }