Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3175)

Unified Diff: webrtc/modules/audio_coding/codecs/ilbc/get_lsp_poly.c

Issue 1988723002: Fix UBSan errors (left shift of negative value) (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/codecs/ilbc/hp_output.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_coding/codecs/ilbc/get_lsp_poly.c
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/get_lsp_poly.c b/webrtc/modules/audio_coding/codecs/ilbc/get_lsp_poly.c
index 62a686495b1c3e4572ce43d2e1bd9155e7773467..a8375afb609246ff78e0e92b43dbb3f5f8587782 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/get_lsp_poly.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/get_lsp_poly.c
@@ -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);
tlegrand 2016/05/17 12:24:32 This is so much nicer!
kwiberg-webrtc 2016/05/17 12:32:29 I've found the "x_low = x - x_high << 16" pattern
- 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;
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/codecs/ilbc/hp_output.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698