1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-13 21:28:01 +02:00

avcodec/bonk: Use unsigned in predictor_init_state() to avoid undefined behavior

Fixes: signed integer overflow: -5010 * -717450 cannot be represented in type 'int'
Fixes: 53370/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BONK_fuzzer-4945644204195840

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 2022-11-16 14:11:51 +01:00
parent 88f0e05c72
commit 8f975641d7
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -280,10 +280,10 @@ static int predictor_calc_error(int *k, int *state, int order, int error)
return x;
}
static void predictor_init_state(int *k, int *state, int order)
static void predictor_init_state(int *k, unsigned *state, int order)
{
for (int i = order - 2; i >= 0; i--) {
int x = state[i];
unsigned x = state[i];
for (int j = 0, p = i + 1; p < order; j++, p++) {
int tmp = x + shift_down(k[j] * state[p], LATTICE_SHIFT);