[FFmpeg-devel] [PATCH 1/2] avcodec/rka: Fix integer overflow in decode_filter()

Michael Niedermayer michael at niedermayer.cc
Fri Jun 30 03:16:54 EEST 2023


Fixes: signed integer overflow: 2147443649 + 65535 cannot be represented in type 'int'
Fixes: 60054/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RKA_fuzzer-5095674572832768

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/rka.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/rka.c b/libavcodec/rka.c
index d56f4faee4..7646d776be 100644
--- a/libavcodec/rka.c
+++ b/libavcodec/rka.c
@@ -745,7 +745,7 @@ static int decode_filter(RKAContext *s, ChContext *ctx, ACoder *ac, int off, uns
                 }
                 ctx->buf1[off] = sum - ctx->buf0[off + -1];
                 ctx->buf0[off] = sum;
-                m += FFABS(ctx->buf1[off]);
+                m += (unsigned)FFABS(ctx->buf1[off]);
             }
         }
         if (ctx->cmode2 != 0) {
-- 
2.17.1



More information about the ffmpeg-devel mailing list