[FFmpeg-cvslog] avcodec/fastaudio: Fix invalid shift exponent

Michael Niedermayer git at videolan.org
Sun Dec 20 00:19:45 EET 2020


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Tue Sep  8 23:03:19 2020 +0200| [2749e20d044c5b014b1cb2749d97078df3a88ba1] | committer: Michael Niedermayer

avcodec/fastaudio: Fix invalid shift exponent

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 at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2749e20d044c5b014b1cb2749d97078df3a88ba1
---

 libavcodec/fastaudio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/fastaudio.c b/libavcodec/fastaudio.c
index 1dda310612..e50678cd3d 100644
--- a/libavcodec/fastaudio.c
+++ b/libavcodec/fastaudio.c
@@ -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);



More information about the ffmpeg-cvslog mailing list