[FFmpeg-devel] [PATCH 1/3] avcodec/flacdec: avoid undefined shift

Michael Niedermayer michael at niedermayer.cc
Wed Dec 27 00:24:43 EET 2017


Fixes: shift exponent 32 is too large for 32-bit type 'unsigned int'
Fixes: 4688/clusterfuzz-testcase-minimized-6572210748653568

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/flacdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index 6c8ba15777..64bea76f98 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -460,7 +460,7 @@ static inline int decode_subframe(FLACContext *s, int channel)
         return AVERROR_INVALIDDATA;
     }
 
-    if (wasted) {
+    if (wasted && wasted < 32) {
         int i;
         for (i = 0; i < s->blocksize; i++)
             decoded[i] = (unsigned)decoded[i] << wasted;
-- 
2.15.1



More information about the ffmpeg-devel mailing list