1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-28 20:53:54 +02:00

avcodec/apedec: fix a integer overflow in long_filter_high_3800()

Fixes: signed integer overflow: -2146549696 - 3923884 cannot be represented in type 'int'
Fixes: 45907/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5992380584558592

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b085b400be)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2022-03-28 00:12:17 +02:00
parent 21caec9402
commit b90025286b

View File

@ -905,7 +905,7 @@ static void long_filter_high_3800(int32_t *buffer, int order, int shift, int len
dotprod += delay[j] * (unsigned)coeffs[j]; dotprod += delay[j] * (unsigned)coeffs[j];
coeffs[j] += ((delay[j] >> 31) | 1) * sign; coeffs[j] += ((delay[j] >> 31) | 1) * sign;
} }
buffer[i] -= dotprod >> shift; buffer[i] -= (unsigned)(dotprod >> shift);
for (j = 0; j < order - 1; j++) for (j = 0; j < order - 1; j++)
delay[j] = delay[j + 1]; delay[j] = delay[j + 1];
delay[order - 1] = buffer[i]; delay[order - 1] = buffer[i];