diff mbox series

[FFmpeg-devel,04/10] avformat/timecode: use 64bit for intermediate for rounding in fps_from_frame_rate()

Message ID 20240326001151.12083-4-michael@niedermayer.cc
State Accepted
Commit 3d8d778a68531b406455f8090d81216ef374ab75
Headers show
Series [FFmpeg-devel,01/10] avformat/concatdec: Check user_duration sum | expand

Checks

Context Check Description
andriy/configure_x86 warning Failed to apply patch
yinshiyou/configure_loongarch64 warning Failed to apply patch

Commit Message

Michael Niedermayer March 26, 2024, 12:11 a.m. UTC
Fixes: 62276/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-4802790784303104
Fixes: signed integer overflow: 1768972133 + 968491058 cannot be represented in type 'int'

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavutil/timecode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavutil/timecode.c b/libavutil/timecode.c
index b93f05b4b82..bd879bd3cc0 100644
--- a/libavutil/timecode.c
+++ b/libavutil/timecode.c
@@ -210,7 +210,7 @@  static int fps_from_frame_rate(AVRational rate)
 {
     if (!rate.den || !rate.num)
         return -1;
-    return (rate.num + rate.den/2) / rate.den;
+    return (rate.num + rate.den/2LL) / rate.den;
 }
 
 int av_timecode_check_frame_rate(AVRational rate)