Fixes: signed integer overflow: 2088795537 + 2147254401 cannot be represented in type 'int'
Fixes: signed integer overflow: -1500363496 + -1295351808 cannot be represented in type 'int'
Fixes: signed integer overflow: -79560 * 32640 cannot be represented in type 'int'
Fixes: signed integer overflow: 2088910005 + 2088796058 cannot be represented in type 'int'
Fixes: signed integer overflow: -117258064 - 2088725225 cannot be represented in type 'int'
Fixes: signed integer overflow: 2088725225 - -117258064 cannot be represented in type 'int'
Fixes: 15739/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5630664122040320
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
... | ... |
@@ -171,12 +171,12 @@ static inline int sign_only(int v) |
171 | 171 |
return v ? FFSIGN(v) : 0; |
172 | 172 |
} |
173 | 173 |
|
174 |
-static void lpc_prediction(int32_t *error_buffer, int32_t *buffer_out, |
|
174 |
+static void lpc_prediction(int32_t *error_buffer, uint32_t *buffer_out, |
|
175 | 175 |
int nb_samples, int bps, int16_t *lpc_coefs, |
176 | 176 |
int lpc_order, int lpc_quant) |
177 | 177 |
{ |
178 | 178 |
int i; |
179 |
- int32_t *pred = buffer_out; |
|
179 |
+ uint32_t *pred = buffer_out; |
|
180 | 180 |
|
181 | 181 |
/* first sample always copies */ |
182 | 182 |
*buffer_out = *error_buffer; |
... | ... |
@@ -208,7 +208,7 @@ static void lpc_prediction(int32_t *error_buffer, int32_t *buffer_out, |
208 | 208 |
for (; i < nb_samples; i++) { |
209 | 209 |
int j; |
210 | 210 |
int val = 0; |
211 |
- int error_val = error_buffer[i]; |
|
211 |
+ unsigned error_val = error_buffer[i]; |
|
212 | 212 |
int error_sign; |
213 | 213 |
int d = *pred++; |
214 | 214 |
|
... | ... |
@@ -222,7 +222,7 @@ static void lpc_prediction(int32_t *error_buffer, int32_t *buffer_out, |
222 | 222 |
/* adapt LPC coefficients */ |
223 | 223 |
error_sign = sign_only(error_val); |
224 | 224 |
if (error_sign) { |
225 |
- for (j = 0; j < lpc_order && error_val * error_sign > 0; j++) { |
|
225 |
+ for (j = 0; j < lpc_order && (int)error_val * error_sign > 0; j++) { |
|
226 | 226 |
int sign; |
227 | 227 |
val = d - pred[j]; |
228 | 228 |
sign = sign_only(val) * error_sign; |