diff mbox

[FFmpeg-devel,1/5] avcodec/ralf: Fix integer overflow in apply_lpc()

Message ID 20191208213120.15190-1-michael@niedermayer.cc
State New
Headers show

Commit Message

Michael Niedermayer Dec. 8, 2019, 9:31 p.m. UTC
Fixes: signed integer overflow: 2147482897 + 2048 cannot be represented in type 'int'
Fixes: 19240/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RALF_fuzzer-5743240326414336

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/libavcodec/ralf.c b/libavcodec/ralf.c
index d8f1803086..15be19b526 100644
--- a/libavcodec/ralf.c
+++ b/libavcodec/ralf.c
@@ -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;