avcodec/wavpack: Fix runtime error: left shift of negative value -14778
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 23 May 2017 22:21:21 +0000 (00:21 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 25 May 2017 12:29:54 +0000 (14:29 +0200)
Fixes: 1778/clusterfuzz-testcase-minimized-5128953268273152

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/wavpack.c

index 20774e6..3b3c6b2 100644 (file)
@@ -113,10 +113,10 @@ static int update_error_limit(WavpackFrameContext *ctx)
     if (ctx->stereo_in && ctx->hybrid_bitrate) {
         int balance = (sl[1] - sl[0] + br[1] + 1) >> 1;
         if (balance > br[0]) {
-            br[1] = br[0] << 1;
+            br[1] = br[0] * 2;
             br[0] = 0;
         } else if (-balance > br[0]) {
-            br[0] <<= 1;
+            br[0]  *= 2;
             br[1]   = 0;
         } else {
             br[1] = br[0] + balance;