aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-06-19 14:08:58 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-06-22 03:07:21 +0200
commit4afd24805954502d771e39107df245620c7e84af (patch)
tree67891c02a0dc8c40ba36732d736c21ea85fb94ba
parentcbc4f40d137279eac5cea66f21fc99d1d87ccc37 (diff)
downloadffmpeg-4afd24805954502d771e39107df245620c7e84af.tar.gz
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@niedermayer.cc> (cherry picked from commit 5f89747086af741ddc34e2378cde8519b8faee78) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/wavpack.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index ec8a9d9bb3..7a87aa36f0 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