avcodec/flacdsp: Fix: runtime error: signed integer overflow: -1027555328 + -12266812...
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 25 Feb 2017 20:07:26 +0000 (21:07 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 26 Feb 2017 16:16:22 +0000 (17:16 +0100)
Fixes: 673/clusterfuzz-testcase-5948736536576000

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/flacdsp.c

index 560091f..bc9a5db 100644 (file)
@@ -67,7 +67,7 @@ static void flac_lpc_16_c(int32_t *decoded, const int coeffs[32],
         int sum = 0;
         for (j = 0; j < pred_order; j++)
             sum += coeffs[j] * (SUINT)decoded[j];
-        decoded[j] += sum >> qlevel;
+        decoded[j] = decoded[j] + (unsigned)(sum >> qlevel);
     }
 }