avcodec/flacdec: Fix undefined shift in decode_subframe()
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 3 Dec 2016 23:11:17 +0000 (00:11 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 4 Dec 2016 00:05:02 +0000 (01:05 +0100)
Fixes undefined behavior
Fixes: 639961-media

Found-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 1f5630af51f24d79053b6bef5b8b3ba93d637306)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/flacdec.c

index 0c4ab43..65edac2 100644 (file)
@@ -448,7 +448,7 @@ static inline int decode_subframe(FLACContext *s, int channel)
     if (wasted) {
         int i;
         for (i = 0; i < s->blocksize; i++)
-            decoded[i] <<= wasted;
+            decoded[i] = (unsigned)decoded[i] << wasted;
     }
 
     return 0;