Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-02-11 01:05:17 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2021-04-01 12:38:44 +0300
commit59c05f51d544a6e4a760cc73317f6cb2756f3a4b (patch)
tree6524498a19791b201c9edd4b3d5adc7c9e7dbf44 /libavcodec/sonic.c
parent79ff380da7a68fc48a52bd823148f233f10df960 (diff)
avcodec/sonic: Use unsigned temporary in predictor_calc_error()
Fixes: signed integer overflow: -2147471366 - 18638 cannot be represented in type 'int' Fixes: 30157/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-5171199746506752 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 075d793ba87635b77f8302d8a454fa681f90d267) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/sonic.c')
-rw-r--r--libavcodec/sonic.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c
index 32e94d24f6..c049f6aedc 100644
--- a/libavcodec/sonic.c
+++ b/libavcodec/sonic.c
@@ -475,13 +475,13 @@ static int predictor_calc_error(int *k, int *state, int order, int error)
for (i = order-2; i >= 0; i--, k_ptr--, state_ptr--)
{
int k_value = *k_ptr, state_value = *state_ptr;
- x -= shift_down(k_value * (unsigned)state_value, LATTICE_SHIFT);
+ x -= (unsigned)shift_down(k_value * (unsigned)state_value, LATTICE_SHIFT);
state_ptr[1] = state_value + shift_down(k_value * (unsigned)x, LATTICE_SHIFT);
}
#else
for (i = order-2; i >= 0; i--)
{
- x -= shift_down(k[i] * state[i], LATTICE_SHIFT);
+ x -= (unsigned)shift_down(k[i] * state[i], LATTICE_SHIFT);
state[i+1] = state[i] + shift_down(k[i] * x, LATTICE_SHIFT);
}
#endif