diff mbox series

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

Message ID 20230630001655.10242-1-michael@niedermayer.cc
State Accepted
Commit f9b29451e422e672595e95eefd03879a4398a1f6
Headers show
Series [FFmpeg-devel,1/2] avcodec/rka: Fix integer overflow in decode_filter() | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer June 30, 2023, 12:16 a.m. UTC
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@niedermayer.cc>
---
 libavcodec/rka.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer July 22, 2023, 3:35 p.m. UTC | #1
On Fri, Jun 30, 2023 at 02:16:54AM +0200, Michael Niedermayer wrote:
> 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@niedermayer.cc>
> ---
>  libavcodec/rka.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply patchset

[...]
diff mbox series

Patch

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) {