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

Unified Diff: webrtc/modules/audio_processing/aecm/aecm_core_c.cc

Issue 3005003002: Make UBSan warnings fatal and fix the existing ones (Closed)
Patch Set: Fix UBSan warnings Created 3 years, 3 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_processing/aecm/aecm_core_c.cc
diff --git a/webrtc/modules/audio_processing/aecm/aecm_core_c.cc b/webrtc/modules/audio_processing/aecm/aecm_core_c.cc
index 32f26569f86618cac35b1fa5779f51605c0d28e7..1865bd1a92cd4ced45d436dabd0a45b7f6e7a62f 100644
--- a/webrtc/modules/audio_processing/aecm/aecm_core_c.cc
+++ b/webrtc/modules/audio_processing/aecm/aecm_core_c.cc
@@ -24,6 +24,7 @@ extern "C" {
}
#include "webrtc/rtc_base/checks.h"
+#include "webrtc/rtc_base/safe_conversions.h"
#include "webrtc/typedefs.h"
// Square root of Hanning window in Q14.
@@ -452,7 +453,8 @@ int WebRtcAecm_ProcessBlock(AecmCore* aecm,
// Far end signal through channel estimate in Q8
// How much can we shift right to preserve resolution
tmp32no1 = echoEst32[i] - aecm->echoFilt[i];
- aecm->echoFilt[i] += (tmp32no1 * 50) >> 8;
+ aecm->echoFilt[i] += rtc::dchecked_cast<int32_t>(
+ (static_cast<int64_t>(tmp32no1) * 50) >> 8);
kwiberg-webrtc 2017/09/03 02:39:47 If you write int64_t{x} instead of static_cast<int
oprypin_webrtc 2017/09/04 08:36:07 OK thanks!
zeros32 = WebRtcSpl_NormW32(aecm->echoFilt[i]) + 1;
zeros16 = WebRtcSpl_NormW16(supGain) + 1;

Powered by Google App Engine
This is Rietveld 408576698