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

Unified Diff: webrtc/modules/audio_coding/codecs/isac/fix/source/transform.c

Issue 1989803002: 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 | « webrtc/modules/audio_coding/codecs/isac/fix/source/lattice.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_coding/codecs/isac/fix/source/transform.c
diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/transform.c b/webrtc/modules/audio_coding/codecs/isac/fix/source/transform.c
index 621f92101348476dcbaaf33a3a7ded701b00bc11..362610a1c442dda4d5d838fef876727eb370a898 100644
--- a/webrtc/modules/audio_coding/codecs/isac/fix/source/transform.c
+++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/transform.c
@@ -132,10 +132,10 @@ void WebRtcIsacfix_Spec2TimeC(int16_t *inreQ7, int16_t *inimQ7, int32_t *outre1Q
tmp1rQ14 = -WebRtcIsacfix_kSinTab2[FRAMESAMPLES/4 - 1 - k];
tmp1iQ14 = WebRtcIsacfix_kSinTab2[k];
- tmpInRe = inreQ7[k] << 9; // Q7 -> Q16
- tmpInIm = inimQ7[k] << 9; // Q7 -> Q16
- tmpInRe2 = inreQ7[FRAMESAMPLES / 2 - 1 - k] << 9; // Q7 -> Q16
- tmpInIm2 = inimQ7[FRAMESAMPLES / 2 - 1 - k] << 9; // Q7 -> Q16
+ tmpInRe = inreQ7[k] * (1 << 9); // Q7 -> Q16
+ tmpInIm = inimQ7[k] * (1 << 9); // Q7 -> Q16
+ tmpInRe2 = inreQ7[FRAMESAMPLES / 2 - 1 - k] * (1 << 9); // Q7 -> Q16
+ tmpInIm2 = inimQ7[FRAMESAMPLES / 2 - 1 - k] * (1 << 9); // Q7 -> Q16
xrQ16 = WEBRTC_SPL_MUL_16_32_RSFT14(tmp1rQ14, tmpInRe) + WEBRTC_SPL_MUL_16_32_RSFT14(tmp1iQ14, tmpInIm);
xiQ16 = WEBRTC_SPL_MUL_16_32_RSFT14(tmp1rQ14, tmpInIm) - WEBRTC_SPL_MUL_16_32_RSFT14(tmp1iQ14, tmpInRe);
@@ -184,8 +184,8 @@ void WebRtcIsacfix_Spec2TimeC(int16_t *inreQ7, int16_t *inimQ7, int32_t *outre1Q
}
} else {
for (k=0; k<240; k++) {
- outre1Q16[k] = inreQ7[k] << -sh; // Q(16+sh) -> Q16
- outre2Q16[k] = inimQ7[k] << -sh; // Q(16+sh) -> Q16
+ outre1Q16[k] = inreQ7[k] * (1 << -sh); // Q(16+sh) -> Q16
+ outre2Q16[k] = inimQ7[k] * (1 << -sh); // Q(16+sh) -> Q16
}
}
« no previous file with comments | « webrtc/modules/audio_coding/codecs/isac/fix/source/lattice.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698