Fix for left shift of potentially negative value.

Left shifting of negative integers is undefined behavior, and should be prevented. This CL fixes one such instance in the Levinson Durbin function.

BUG=chromium:675349

Review-Url: https://codereview.webrtc.org/2621693002
Cr-Commit-Position: refs/heads/master@{#15984}
This commit is contained in:
ivoc
2017-01-10 03:37:20 -08:00
committed by Commit bot
parent 6969c56871
commit abf1752ff4

View File

@ -193,7 +193,7 @@ int16_t WebRtcSpl_LevinsonDurbin(const int32_t* R, int16_t* A, int16_t* K,
// Alpha = Alpha * (1-K^2)
temp1W32 = ((K_hi * K_low >> 14) + K_hi * K_hi) << 1; // K*K in Q31
temp1W32 = ((K_hi * K_low >> 14) + K_hi * K_hi) * 2; // K*K in Q31
temp1W32 = WEBRTC_SPL_ABS_W32(temp1W32); // Guard against <0
temp1W32 = (int32_t)0x7fffffffL - temp1W32; // 1 - K*K in Q31