[FFmpeg-cvslog] avformat/mov: use 64bit for intermediate for rounding

Michael Niedermayer git at videolan.org
Sun Apr 14 20:34:59 EEST 2024


ffmpeg | branch: release/5.1 | Michael Niedermayer <michael at niedermayer.cc> | Tue Mar 26 00:27:39 2024 +0100| [a3fccb9729e7e31adb12ee953920cf56472c0309] | committer: Michael Niedermayer

avformat/mov: use 64bit for intermediate for rounding

Fixes: signed integer overflow: 1768972133 + 968491058 cannot be represented in type 'int'
Fixes: 62276/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-4802790784303104

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit f01a89c5a378cb7b55a0bcb5763cfb1da83b81f1)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a3fccb9729e7e31adb12ee953920cf56472c0309
---

 libavformat/mov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index b4b357eee4..976c552e9b 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -8104,7 +8104,7 @@ static int mov_read_timecode_track(AVFormatContext *s, AVStream *st)
     /* 60 fps content have tmcd_nb_frames set to 30 but tc_rate set to 60, so
      * we multiply the frame number with the quotient.
      * See tickets #9492, #9710. */
-    rounded_tc_rate = (tc_rate.num + tc_rate.den / 2) / tc_rate.den;
+    rounded_tc_rate = (tc_rate.num + tc_rate.den / 2LL) / tc_rate.den;
     /* Work around files where tmcd_nb_frames is rounded down from frame rate
      * instead of up. See ticket #5978. */
     if (tmcd_nb_frames == tc_rate.num / tc_rate.den &&



More information about the ffmpeg-cvslog mailing list