Fix UBSan errors (left shift of negative value)
BUG=chromium:603501 Review-Url: https://codereview.webrtc.org/1988723002 Cr-Commit-Position: refs/heads/master@{#12775}
This commit is contained in:
@ -65,15 +65,15 @@ void WebRtcIlbcfix_GetLspPoly(
|
||||
{
|
||||
/* Compute f[j] = f[j] + tmp*f[j-1] + f[j-2]; */
|
||||
high = (int16_t)(fPtr[-1] >> 16);
|
||||
low = (int16_t)((fPtr[-1] - ((int32_t)high << 16)) >> 1);
|
||||
low = (int16_t)((fPtr[-1] & 0xffff) >> 1);
|
||||
|
||||
tmpW32 = ((high * *lspPtr) << 2) + (((low * *lspPtr) >> 15) << 2);
|
||||
tmpW32 = 4 * high * *lspPtr + 4 * ((low * *lspPtr) >> 15);
|
||||
|
||||
(*fPtr) += fPtr[-2];
|
||||
(*fPtr) -= tmpW32;
|
||||
fPtr--;
|
||||
}
|
||||
*fPtr -= *lspPtr << 10;
|
||||
*fPtr -= *lspPtr * (1 << 10);
|
||||
|
||||
fPtr+=i;
|
||||
lspPtr+=2;
|
||||
|
||||
@ -48,7 +48,7 @@ void WebRtcIlbcfix_HpOutput(
|
||||
tmpW32 = (tmpW32>>15);
|
||||
tmpW32 += y[0] * ba[3]; /* (-a[1])*y[i-1] (high part) */
|
||||
tmpW32 += y[2] * ba[4]; /* (-a[2])*y[i-2] (high part) */
|
||||
tmpW32 = (tmpW32<<1);
|
||||
tmpW32 *= 2;
|
||||
|
||||
tmpW32 += signal[i] * ba[0]; /* b[0]*x[0] */
|
||||
tmpW32 += x[0] * ba[1]; /* b[1]*x[i-1] */
|
||||
@ -77,11 +77,11 @@ void WebRtcIlbcfix_HpOutput(
|
||||
} else if (tmpW32<-268435456) {
|
||||
tmpW32 = WEBRTC_SPL_WORD32_MIN;
|
||||
} else {
|
||||
tmpW32 <<= 3;
|
||||
tmpW32 *= 8;
|
||||
}
|
||||
|
||||
y[0] = (int16_t)(tmpW32 >> 16);
|
||||
y[1] = (int16_t)((tmpW32 - (y[0] << 16)) >> 1);
|
||||
y[1] = (int16_t)((tmpW32 & 0xffff) >> 1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user