]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/alsdec: Fix 2 integer overflows
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 6 Jul 2019 21:20:30 +0000 (23:20 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 21 Jul 2019 09:26:36 +0000 (11:26 +0200)
Fixes: signed integer overflow: 1270564968 + 904828220 cannot be represented in type 'int'
Fixes: 15402/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5755426823471104
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/alsdec.c

index 5eb2a58aaf01d828e51ad1940d597f52321b0ebf..8201deb366d5b94282ea1862fd04dc1e0939230c 100644 (file)
@@ -507,7 +507,7 @@ static void parcor_to_lpc(unsigned int k, const int32_t *par, int32_t *cof)
     int i, j;
 
     for (i = 0, j = k - 1; i < j; i++, j--) {
-        int tmp1 = ((MUL64(par[k], cof[j]) + (1 << 19)) >> 20);
+        unsigned tmp1 = ((MUL64(par[k], cof[j]) + (1 << 19)) >> 20);
         cof[j]  += ((MUL64(par[k], cof[i]) + (1 << 19)) >> 20);
         cof[i]  += tmp1;
     }
@@ -980,7 +980,7 @@ static int decode_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
         y = 1 << 19;
 
         for (sb = -opt_order; sb < 0; sb++)
-            y += MUL64(lpc_cof[sb], raw_samples[sb]);
+            y += (uint64_t)MUL64(lpc_cof[sb], raw_samples[sb]);
 
         *raw_samples -= y >> 20;
     }