1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

avcodec/apedec: Fix integer overflow in filter_fast_3320()

Fixes: signed integer overflow: 2145649668 + 3956526 cannot be represented in type 'int'
Fixes: 38351/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-4647077926273024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2021-09-17 21:40:59 +02:00
parent 8e67cfe15b
commit 0e45886e6e

View File

@ -879,7 +879,7 @@ static av_always_inline int filter_fast_3320(APEPredictor *p,
} }
predictionA = p->buf[delayA] * 2U - 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); p->lastA[filter] = decoded + (unsigned)((int32_t)(predictionA * p->coeffsA[filter][0]) >> 9);
if ((decoded ^ predictionA) > 0) if ((decoded ^ predictionA) > 0)
p->coeffsA[filter][0]++; p->coeffsA[filter][0]++;