]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/apedec: Fix multiple integer overflows in predictor_update_filter()
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 16 Jun 2019 08:54:13 +0000 (10:54 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 21 Jul 2019 09:26:35 +0000 (11:26 +0200)
Fixes: signed integer overflow: -829262115 + -1410750414 cannot be represented in type 'int'
Fixes: 15251/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5651742252859392
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 eb31fd70c16c01707a3ae8b36b91df90b9930873..63335f542ca768e54983261e3147678cb8041f0d 100644 (file)
@@ -1142,7 +1142,7 @@ static av_always_inline int predictor_update_filter(APEPredictor *p,
                   p->buf[delayB - 3] * p->coeffsB[filter][3] +
                   p->buf[delayB - 4] * p->coeffsB[filter][4];
 
-    p->lastA[filter] = decoded + ((predictionA + (predictionB >> 1)) >> 10);
+    p->lastA[filter] = decoded + ((int)((unsigned)predictionA + (predictionB >> 1)) >> 10);
     p->filterA[filter] = p->lastA[filter] + ((p->filterA[filter] * 31) >> 5);
 
     sign = APESIGN(decoded);