]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/alsdec: Fix integer overflow with shifting samples
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 19 Jun 2019 21:27:21 +0000 (23:27 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 6 Jul 2019 20:50:21 +0000 (22:50 +0200)
Fixes: signed integer overflow: -346039050 * 8 cannot be represented in type 'int'
Fixes: 15283/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5692700268953600
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 e54440910c06a32f730179b5c9446c75cc22a9ed..420bcf835a380e6b847827a18d81e2b8d03ffe1f 100644 (file)
@@ -1033,7 +1033,7 @@ static int decode_block(ALSDecContext *ctx, ALSBlockData *bd)
 
     if (*bd->shift_lsbs)
         for (smp = 0; smp < bd->block_length; smp++)
-            bd->raw_samples[smp] <<= *bd->shift_lsbs;
+            bd->raw_samples[smp] = (unsigned)bd->raw_samples[smp] << *bd->shift_lsbs;
 
     return 0;
 }