Fixes: 10651/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ILBC_fuzzer-
5202341540659200
Fixes: left shift of negative value -512
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
for (j = i; j > 1; j--, l--) {
high = f[l - 1] >> 16;
for (j = i; j > 1; j--, l--) {
high = f[l - 1] >> 16;
- low = (f[l - 1] - (high << 16)) >> 1;
+ low = (f[l - 1] - (high * (1 << 16))) >> 1;
- tmp = ((high * lsp[k]) << 2) + (((low * lsp[k]) >> 15) << 2);
+ tmp = ((high * lsp[k]) * 4) + (((low * lsp[k]) >> 15) * 4);
f[l] += f[l - 2];
f[l] -= tmp;
}
f[l] += f[l - 2];
f[l] -= tmp;
}
+ f[l] -= lsp[k] * (1 << 10);
/* Calculate the total number of (dynamic) right shifts that have
been performed on (cross_corr*cross_corr)/energy
*/
/* Calculate the total number of (dynamic) right shifts that have
been performed on (cross_corr*cross_corr)/energy
*/
- totscale = energy_scale - (cross_corr_scale << 1);
+ totscale = energy_scale - (cross_corr_scale * 2);
/* Calculate the shift difference in order to be able to compare the two
(cross_corr*cross_corr)/energy in the same domain
/* Calculate the shift difference in order to be able to compare the two
(cross_corr*cross_corr)/energy in the same domain
tmp = (tmp >> 15);
tmp += SPL_MUL_16_16(y[0], ba[3]); /* (-a[1])*y[i-1] (high part) */
tmp += SPL_MUL_16_16(y[2], ba[4]); /* (-a[2])*y[i-2] (high part) */
tmp = (tmp >> 15);
tmp += SPL_MUL_16_16(y[0], ba[3]); /* (-a[1])*y[i-1] (high part) */
tmp += SPL_MUL_16_16(y[2], ba[4]); /* (-a[2])*y[i-2] (high part) */
tmp += SPL_MUL_16_16(signal[i], ba[0]); /* b[0]*x[0] */
tmp += SPL_MUL_16_16(x[0], ba[1]); /* b[1]*x[i-1] */
tmp += SPL_MUL_16_16(signal[i], ba[0]); /* b[0]*x[0] */
tmp += SPL_MUL_16_16(x[0], ba[1]); /* b[1]*x[i-1] */
} else if (tmp < -268435456) {
tmp = INT32_MIN;
} else {
} else if (tmp < -268435456) {
tmp = INT32_MIN;
} else {
- y[1] = (tmp - (y[0] << 16)) >> 1;
+ y[1] = (tmp - (y[0] * (1 << 16))) >> 1;