aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/rka.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2023-06-08 15:05:50 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2023-06-18 14:29:11 +0200
commite736238b35a1e0f69fe8e5a9a7359ba24883c488 (patch)
tree45beb62b051f09b18f71d1eb61107f3315838338 /libavcodec/rka.c
parent1ee303f1e1677fd997da05ae1cc6aca064f96bdb (diff)
downloadffmpeg-e736238b35a1e0f69fe8e5a9a7359ba24883c488.tar.gz
avcodec/rka: use unsigned for buf0 additions
Fixes: signed integer overflow: -38912000 + -2109276160 cannot be represented in type 'int' Fixes: 59670/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RKA_fuzzer-4987563245699072 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/rka.c')
-rw-r--r--libavcodec/rka.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/rka.c b/libavcodec/rka.c
index 76dca52602..d56f4faee4 100644
--- a/libavcodec/rka.c
+++ b/libavcodec/rka.c
@@ -735,10 +735,10 @@ static int decode_filter(RKAContext *s, ChContext *ctx, ACoder *ac, int off, uns
ctx->buf1[off] = (val + (sum >> bits)) * (1U << bits) +
(((1U << bits) - 1U) & ctx->buf1[off + -1]);
}
- ctx->buf0[off] = ctx->buf1[off] + ctx->buf0[off + -1];
+ ctx->buf0[off] = ctx->buf1[off] + (unsigned)ctx->buf0[off + -1];
} else {
val *= 1U << ctx->cmode;
- sum += ctx->buf0[off + -1] + val;
+ sum += ctx->buf0[off + -1] + (unsigned)val;
switch (s->bps) {
case 16: sum = av_clip_int16(sum); break;
case 8: sum = av_clip_int8(sum); break;