[FFmpeg-cvslog] avformat/replaygain: avoid undefined / negative abs

Michael Niedermayer git at videolan.org
Sun Jun 4 22:04:32 EEST 2023


ffmpeg | branch: release/3.4 | Michael Niedermayer <michael at niedermayer.cc> | Fri Oct 28 23:28:59 2022 +0200| [bf0b88d00a54b911c655175f88d2071b6c99b994] | committer: Michael Niedermayer

avformat/replaygain: avoid undefined / negative abs

Fixes: signed integer overflow: -2147483648 * 100000 cannot be represented in type 'int'
Fixes: 52060/clusterfuzz-testcase-minimized-ffmpeg_dem_MP3_fuzzer-5131616708329472

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

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

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

diff --git a/libavformat/replaygain.c b/libavformat/replaygain.c
index 707d3cd4f1..01db483257 100644
--- a/libavformat/replaygain.c
+++ b/libavformat/replaygain.c
@@ -61,7 +61,7 @@ static int32_t parse_value(const char *value, int32_t min)
         }
     }
 
-    if (abs(db) > (INT32_MAX - mb) / 100000)
+    if (llabs(db) > (INT32_MAX - mb) / 100000)
         return min;
 
     return db * 100000 + sign * mb;



More information about the ffmpeg-cvslog mailing list