[FFmpeg-cvslog] avcodec/apedec: Fix multiple integer overflows in predictor_update_filter()

Michael Niedermayer git at videolan.org
Sun Jul 21 15:06:10 EEST 2019


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sun Jun 16 10:54:13 2019 +0200| [0af08cb803844b9eba4ff3e552c26452ec6fa7d2] | committer: Michael Niedermayer

avcodec/apedec: Fix multiple integer overflows in predictor_update_filter()

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 at niedermayer.cc>

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

 libavcodec/apedec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index eb31fd70c1..63335f542c 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -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);



More information about the ffmpeg-cvslog mailing list