]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/fastaudio: Fix invalid shift exponent
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 8 Sep 2020 21:03:19 +0000 (23:03 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 19 Dec 2020 22:19:29 +0000 (23:19 +0100)
Fixes: shift exponent 32 is too large for 32-bit type 'unsigned int'
Fixes: 25434/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FASTAUDIO_fuzzer-6252363168612352
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/fastaudio.c

index 1dda310612c31bcaab2884390a44a188eaf4279d..e50678cd3d54486b2f88b5f98396888432a53a9f 100644 (file)
@@ -89,7 +89,7 @@ static int read_bits(int bits, int *ppos, unsigned *src)
 
     pos = *ppos;
     pos += bits;
-    r = src[(pos - 1) / 32] >> (32 - pos % 32);
+    r = src[(pos - 1) / 32] >> ((-pos) & 31);
     *ppos = pos;
 
     return r & ((1 << bits) - 1);