]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/apedec: Fix integer overflow in filter_fast_3320()
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 17 Aug 2019 22:28:34 +0000 (00:28 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 2 Sep 2019 19:37:18 +0000 (21:37 +0200)
Fixes: signed integer overflow: -1094994793 * 2 cannot be represented in type 'int'
Fixes: 16139/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5663911036059648
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/apedec.c

index 70939abeb4ffc6ee3087758d4e9895e1e1ad7f34..5d82ff53ff044814e0b435469de04c566a69c38e 100644 (file)
@@ -828,7 +828,7 @@ static av_always_inline int filter_fast_3320(APEPredictor *p,
         return decoded;
     }
 
-    predictionA = p->buf[delayA] * 2 - p->buf[delayA - 1];
+    predictionA = p->buf[delayA] * 2U - p->buf[delayA - 1];
     p->lastA[filter] = decoded + ((int32_t)(predictionA  * p->coeffsA[filter][0]) >> 9);
 
     if ((decoded ^ predictionA) > 0)