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:681377

Review-Url: https://codereview.webrtc.org/2680973005
Cr-Commit-Position: refs/heads/master@{#16507}
This commit is contained in:
ivoc 2017-02-09 03:05:59 -08:00 committed by Commit bot
parent 2324b35890
commit a48e1b6bc3

View File

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