]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/ralf: Fix integer overflow in apply_lpc()
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 8 Dec 2019 12:48:45 +0000 (13:48 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 2 Feb 2020 23:11:18 +0000 (00:11 +0100)
Fixes: signed integer overflow: 2147482897 + 2048 cannot be represented in type 'int'
Fixes: 19240/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RALF_fuzzer-5743240326414336
Fixes: 19869/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RALF_fuzzer-5150136636538880
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/ralf.c

index 5d88b4c9439d14cf0c310fcbe2f1abe3163777bb..831728177e94ac90af2c1fa1b5f992eecb747585 100644 (file)
@@ -330,7 +330,7 @@ static void apply_lpc(RALFContext *ctx, int ch, int length, int bits)
             acc = (acc + bias - 1) >> ctx->filter_bits;
             acc = FFMAX(acc, min_clip);
         } else {
-            acc = (acc + bias) >> ctx->filter_bits;
+            acc = ((unsigned)acc + bias) >> ctx->filter_bits;
             acc = FFMIN(acc, max_clip);
         }
         audio[i] += acc;