]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/alac: Fix integer overflow in LPC
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 30 Sep 2019 22:16:20 +0000 (00:16 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 20 Oct 2019 17:57:51 +0000 (19:57 +0200)
Fixes: signed integer overflow: 2147483628 + 128 cannot be represented in type 'int'
Fixes: 17783/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5146470595952640
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/alac.c

index fbe427595e97fec5a32f492a9a7cddfd655ebd75..09decb806b6a87ba58760ca696ab9aa5130e5b9d 100644 (file)
@@ -215,7 +215,7 @@ static void lpc_prediction(int32_t *error_buffer, uint32_t *buffer_out,
         /* LPC prediction */
         for (j = 0; j < lpc_order; j++)
             val += (pred[j] - d) * lpc_coefs[j];
-        val = (val + (1 << (lpc_quant - 1))) >> lpc_quant;
+        val = (val + (1LL << (lpc_quant - 1))) >> lpc_quant;
         val += d + error_val;
         buffer_out[i] = sign_extend(val, bps);