[FFmpeg-cvslog] avformat/jacosubdec: Use 64bit for abs

Michael Niedermayer git at videolan.org
Sun Apr 14 04:44:29 EEST 2024


ffmpeg | branch: release/6.1 | Michael Niedermayer <michael at niedermayer.cc> | Tue Mar 26 00:21:28 2024 +0100| [6cc785c255adb35c46890e271094134529d7947f] | committer: Michael Niedermayer

avformat/jacosubdec: Use 64bit for abs

Fixes: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
Fixes: 62276/clusterfuzz-testcase-minimized-ffmpeg_dem_JACOSUB_fuzzer-5401294942371840

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 746203af3116288b1dd4442e46a5724ba759e831)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c
index 60fe72d5d7..e22bbd788c 100644
--- a/libavformat/jacosubdec.c
+++ b/libavformat/jacosubdec.c
@@ -149,7 +149,7 @@ static int get_shift(unsigned timeres, const char *buf)
     }
 
     ret = (int64_t)h*3600 + (int64_t)m*60 + s;
-    if (FFABS(ret) > (INT64_MAX - FFABS(d)) / timeres)
+    if (FFABS(ret) > (INT64_MAX - FFABS((int64_t)d)) / timeres)
         return 0;
     ret = sign * (ret * timeres + d);
 



More information about the ffmpeg-cvslog mailing list