1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/sonic: Fix several integer state overflows

Fixes: signed integer overflow: -234 * -14797801 cannot be represented in type 'int'
Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-5695924975435776
Fixes: 22275/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-5695924975435776

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 2020-05-10 21:09:45 +02:00
parent 75d520e337
commit 61d9bf514d

View File

@ -458,8 +458,8 @@ static void predictor_init_state(int *k, int *state, int order)
for (j = 0, p = i+1; p < order; j++,p++)
{
int tmp = x + shift_down(k[j] * state[p], LATTICE_SHIFT);
state[p] += shift_down(k[j]*x, LATTICE_SHIFT);
int tmp = x + shift_down(k[j] * (unsigned)state[p], LATTICE_SHIFT);
state[p] += shift_down(k[j]* (unsigned)x, LATTICE_SHIFT);
x = tmp;
}
}
@ -467,7 +467,7 @@ static void predictor_init_state(int *k, int *state, int order)
static int predictor_calc_error(int *k, int *state, int order, int error)
{
int i, x = error - shift_down(k[order-1] * state[order-1], LATTICE_SHIFT);
int i, x = error - shift_down(k[order-1] * (unsigned)state[order-1], LATTICE_SHIFT);
#if 1
int *k_ptr = &(k[order-2]),