[FFmpeg-devel] [PATCH 2/6] avformat/avidec: Correct unsigend type

Michael Niedermayer michael at niedermayer.cc
Sat Sep 30 02:19:57 EEST 2023


Fixes: signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'long long'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-6706191715139584

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

diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index cfc693842b7..95a6cbe930e 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -1704,7 +1704,7 @@ static int check_stream_max_drift(AVFormatContext *s)
     int *idx = av_calloc(s->nb_streams, sizeof(*idx));
     if (!idx)
         return AVERROR(ENOMEM);
-    for (min_pos = pos = 0; min_pos != INT64_MAX; pos = min_pos + 1LU) {
+    for (min_pos = pos = 0; min_pos != INT64_MAX; pos = min_pos + 1llu) {
         int64_t max_dts = INT64_MIN / 2;
         int64_t min_dts = INT64_MAX / 2;
         int64_t max_buffer = 0;
-- 
2.17.1



More information about the ffmpeg-devel mailing list