1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/rka: avoid undefined doubling sum overflow

Fixes: signed integer overflow: -2124073172 * 2 cannot be represented in type 'int'
Fixes: 56099/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RKA_fuzzer-4530933127839744

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2023-02-20 20:09:36 +01:00
parent a5d4e7e3f9
commit a02e45a1f3
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -724,7 +724,7 @@ static int decode_filter(RKAContext *s, ChContext *ctx, ACoder *ac, int off, uns
src = &ctx->buf1[off + -1];
for (int i = 0; i < filt.size && i < 15; i++)
sum += filt.coeffs[i] * (unsigned)src[-i];
sum = sum * 2;
sum = sum * 2U;
for (int i = 15; i < filt.size; i++)
sum += filt.coeffs[i] * (unsigned)src[-i];
sum = sum >> 6;