[FFmpeg-devel] [PATCH 1/4] avformat/replaygain: avoid undefined / negative abs

Michael Niedermayer michael at niedermayer.cc
Sat Oct 29 22:13:50 EEST 2022


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>
---
 libavformat/replaygain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/replaygain.c b/libavformat/replaygain.c
index 24f5c74183..915bcb2382 100644
--- a/libavformat/replaygain.c
+++ b/libavformat/replaygain.c
@@ -60,7 +60,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;
-- 
2.17.1



More information about the ffmpeg-devel mailing list