[FFmpeg-cvslog] avcodec/wavpack: Fix signed integer overflow: 1285114081 * 2 cannot be represented in type 'int'

Michael Niedermayer git at videolan.org
Mon May 8 18:03:01 EEST 2017


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Thu May  4 23:41:28 2017 +0200| [aaeec1c654a2c139a7bc95e677a23d8ac57f1c5e] | committer: Michael Niedermayer

avcodec/wavpack: Fix signed integer overflow: 1285114081 * 2 cannot be represented in type 'int'

Fixes: 945/clusterfuzz-testcase-6037937588273152
Fixes: integer overflow

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/wavpack.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index bc4402f638..d2ba97ee2c 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -240,7 +240,7 @@ static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb,
         if (get_bits_left(gb) <= 0)
             goto error;
     } else {
-        int mid = (base * 2 + add + 1) >> 1;
+        int mid = (base * 2U + add + 1) >> 1;
         while (add > c->error_limit) {
             if (get_bits_left(gb) <= 0)
                 goto error;
@@ -249,7 +249,7 @@ static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb,
                 base = mid;
             } else
                 add = mid - base - 1;
-            mid = (base * 2 + add + 1) >> 1;
+            mid = (base * 2U + add + 1) >> 1;
         }
         ret = mid;
     }



More information about the ffmpeg-cvslog mailing list