]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/wavpack: Fix integer overflow in FFABS
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 31 Jan 2018 01:50:18 +0000 (02:50 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 3 Feb 2018 20:37:19 +0000 (21:37 +0100)
Fixes: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
Fixes: 5396/clusterfuzz-testcase-minimized-6558555529281536
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 d5e1e07b743bec527ecd1c703d3ced5827df1571..0e40b29879959a4a003e27a60248fe2653dd76bb 100644 (file)
@@ -480,7 +480,7 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb,
         }
 
         if (type == AV_SAMPLE_FMT_S16P) {
-            if (FFABS(L) + (unsigned)FFABS(R) > (1<<19)) {
+            if (FFABS((int64_t)L) + FFABS((int64_t)R) > (1<<19)) {
                 av_log(s->avctx, AV_LOG_ERROR, "sample %d %d too large\n", L, R);
                 return AVERROR_INVALIDDATA;
             }