avcodec/aacdec_fixed: Fix undefined shift in noise_scale()
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 29 Mar 2019 07:58:49 +0000 (08:58 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 9 May 2019 09:22:35 +0000 (11:22 +0200)
Fixes: 13655/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5120559430500352

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 8ea211ab79d646f6d0af0945971ee55f36bfcbc9)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/aacdec_fixed.c

index c92f873..90b933e 100644 (file)
@@ -221,7 +221,7 @@ static void noise_scale(int *coefs, int scale, int band_energy, int len)
     }
     else {
         s = s + 32;
-        round = 1 << (s-1);
+        round = s ? 1 << (s-1) : 0;
         for (i=0; i<len; i++) {
             out = (int)((int64_t)((int64_t)coefs[i] * c + round) >> s);
             coefs[i] = out * ssign;