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

Unified Diff: webrtc/modules/audio_coding/codecs/ilbc/hp_output.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
Index: webrtc/modules/audio_coding/codecs/ilbc/hp_output.c
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/hp_output.c b/webrtc/modules/audio_coding/codecs/ilbc/hp_output.c
index bd101bf30caf0a07c17eab1a39fd8963b60a2c77..8b18c047b938cd33dc3577ce947365550fd5d159 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/hp_output.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/hp_output.c
@@ -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);
}

Powered by Google App Engine
This is Rietveld 408576698