[FFmpeg-cvslog] avcodec/wavpack: Fix undefined integer negation

Michael Niedermayer git at videolan.org
Sun Jul 30 00:34:09 EEST 2017


ffmpeg | branch: release/3.2 | Michael Niedermayer <michael at niedermayer.cc> | Mon Jun 19 14:08:58 2017 +0200| [9125bbb3e58d46364e814577d15804c958e0c226] | committer: Michael Niedermayer

avcodec/wavpack: Fix undefined integer negation

Fixes: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
Fixes: 2291/clusterfuzz-testcase-minimized-5538453481586688

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 5f89747086af741ddc34e2378cde8519b8faee78)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 72d5613363..3776994afe 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -307,8 +307,8 @@ static float wv_get_value_float(WavpackFrameContext *s, uint32_t *crc, int S)
         S  <<= s->float_shift;
         sign = S < 0;
         if (sign)
-            S = -S;
-        if (S >= 0x1000000) {
+            S = -(unsigned)S;
+        if (S >= 0x1000000U) {
             if (s->got_extra_bits && get_bits1(&s->gb_extra_bits))
                 S = get_bits(&s->gb_extra_bits, 23);
             else



More information about the ffmpeg-cvslog mailing list