Revert of Re-enable UBsan on AGC. (patchset #8 id:300001 of https://codereview.webrtc.org/2003623003/ )

Reason for revert:
Breaks bot.

Original issue's description:
> Re-enable UBsan on AGC.
>
> BUG=webrtc:5530
>
> Committed: https://crrev.com/293c86d67384c15f46b8296096a62a14b4a58d33
> Cr-Commit-Position: refs/heads/master@{#13034}

R=kjellander@webrtc.org, peah@webrtc.org
TBR=kjellander@webrtc.org, minyue@webrtc.org, peah@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5530

Review URL: https://codereview.webrtc.org/2056683002 .

Cr-Commit-Position: refs/heads/master@{#13096}
diff --git a/tools/ubsan/blacklist.txt b/tools/ubsan/blacklist.txt
index 0d887e5..7a92cdb 100644
--- a/tools/ubsan/blacklist.txt
+++ b/tools/ubsan/blacklist.txt
@@ -23,6 +23,12 @@
 fun:*FilterBanksTest*CalculateResidualEnergyTester*
 
 #############################################################################
+# The audio processing AGC submodule exhibits a few problems (overflows).
+# https://bugs.chromium.org/p/webrtc/issues/detail?id=5530
+src:*/webrtc/modules/audio_processing/agc/legacy/analog_agc.c
+src:*/webrtc/modules/audio_processing/agc/legacy/digital_agc.c
+
+#############################################################################
 # Ignore errors in common_audio.
 # https://bugs.chromium.org/p/webrtc/issues/detail?id=5486
 src:*/webrtc/common_audio/signal_processing/signal_processing_unittest.cc
diff --git a/webrtc/modules/audio_processing/agc/legacy/analog_agc.c b/webrtc/modules/audio_processing/agc/legacy/analog_agc.c
index 2450e05..36c67c2 100644
--- a/webrtc/modules/audio_processing/agc/legacy/analog_agc.c
+++ b/webrtc/modules/audio_processing/agc/legacy/analog_agc.c
@@ -474,18 +474,18 @@
 
 void WebRtcAgc_ZeroCtrl(LegacyAgc* stt, int32_t* inMicLevel, int32_t* env) {
   int16_t i;
-  int64_t tmp = 0;
+  int32_t tmp32 = 0;
   int32_t midVal;
 
   /* Is the input signal zero? */
   for (i = 0; i < 10; i++) {
-    tmp += env[i];
+    tmp32 += env[i];
   }
 
   /* Each block is allowed to have a few non-zero
    * samples.
    */
-  if (tmp < 500) {
+  if (tmp32 < 500) {
     stt->msZero += 10;
   } else {
     stt->msZero = 0;
diff --git a/webrtc/modules/audio_processing/agc/legacy/digital_agc.c b/webrtc/modules/audio_processing/agc/legacy/digital_agc.c
index 231a204..2ca967a 100644
--- a/webrtc/modules/audio_processing/agc/legacy/digital_agc.c
+++ b/webrtc/modules/audio_processing/agc/legacy/digital_agc.c
@@ -189,7 +189,7 @@
     // Calculate ratio
     // Shift |numFIX| as much as possible.
     // Ensure we avoid wrap-around in |den| as well.
-    if (numFIX > (den >> 8) || -numFIX > (den >> 8))  // |den| is Q8.
+    if (numFIX > (den >> 8))  // |den| is Q8.
     {
       zeros = WebRtcSpl_NormW32(numFIX);
     } else {
@@ -198,11 +198,13 @@
     numFIX *= 1 << zeros;  // Q(14+zeros)
 
     // Shift den so we end up in Qy1
-    tmp32no1 = WEBRTC_SPL_SHIFT_W32(den, zeros - 9);  // Q(zeros - 1)
-    y32 = numFIX / tmp32no1;  // in Q15
-    // This is to do rounding in Q14.
-    y32 = y32 >= 0 ? (y32 + 1) >> 1 : -((-y32 + 1) >> 1);
-
+    tmp32no1 = WEBRTC_SPL_SHIFT_W32(den, zeros - 8);  // Q(zeros)
+    if (numFIX < 0) {
+      numFIX -= tmp32no1 / 2;
+    } else {
+      numFIX += tmp32no1 / 2;
+    }
+    y32 = numFIX / tmp32no1;  // in Q14
     if (limiterEnable && (i < limiterIdx)) {
       tmp32 = WEBRTC_SPL_MUL_16_U16(i - 1, kLog10_2);  // Q14
       tmp32 -= limiterLvl * (1 << 14);                 // Q14
diff --git a/webrtc/modules/audio_processing/gain_control_unittest.cc b/webrtc/modules/audio_processing/gain_control_unittest.cc
index c3d1d6c..c5de236 100644
--- a/webrtc/modules/audio_processing/gain_control_unittest.cc
+++ b/webrtc/modules/audio_processing/gain_control_unittest.cc
@@ -218,7 +218,7 @@
      DISABLED_Mono8kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
 #endif
   const int kStreamAnalogLevelReference = 50;
-  const float kOutputReference[] = {-0.004028f, -0.001678f, 0.000946f};
+  const float kOutputReference[] = {-0.006317f, -0.002625f, 0.001495f};
   RunBitExactnessTest(8000, 1, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
                       true, 0, 100, kStreamAnalogLevelReference,
                       kOutputReference);
@@ -233,7 +233,7 @@
      DISABLED_Mono16kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
 #endif
   const int kStreamAnalogLevelReference = 50;
-  const float kOutputReference[] = {-0.003967f, -0.002808f, -0.001770f};
+  const float kOutputReference[] = {-0.006256f, -0.004395f, -0.002777f};
   RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
                       true, 0, 100, kStreamAnalogLevelReference,
                       kOutputReference);
@@ -248,8 +248,8 @@
      DISABLED_Stereo16kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
 #endif
   const int kStreamAnalogLevelReference = 50;
-  const float kOutputReference[] = {-0.015411f, -0.008972f, -0.015839f,
-                                    -0.015411f, -0.008972f, -0.015839f};
+  const float kOutputReference[] = {-0.023956f, -0.013947f, -0.024597f,
+                                    -0.023956f, -0.013947f, -0.024597f};
   RunBitExactnessTest(16000, 2, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
                       true, 0, 100, kStreamAnalogLevelReference,
                       kOutputReference);
@@ -264,7 +264,7 @@
      DISABLED_Mono32kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
 #endif
   const int kStreamAnalogLevelReference = 50;
-  const float kOutputReference[] = {-0.006134f, -0.005554f, -0.005005f};
+  const float kOutputReference[] = {-0.009644f, -0.008728f, -0.007904f};
   RunBitExactnessTest(32000, 1, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
                       true, 0, 100, kStreamAnalogLevelReference,
                       kOutputReference);
@@ -279,7 +279,7 @@
      DISABLED_Mono48kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
 #endif
   const int kStreamAnalogLevelReference = 50;
-  const float kOutputReference[] = {-0.006134f, -0.005554f, -0.005005f};
+  const float kOutputReference[] = {-0.009644f, -0.008728f, -0.007904f};
   RunBitExactnessTest(32000, 1, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
                       true, 0, 100, kStreamAnalogLevelReference,
                       kOutputReference);
@@ -385,7 +385,7 @@
      DISABLED_Mono16kHz_AdaptiveAnalog_Tl10_SL100_CG5_Lim_AL70_80) {
 #endif
   const int kStreamAnalogLevelReference = 100;
-  const float kOutputReference[] = {-0.004028f, -0.002838f, -0.001801f};
+  const float kOutputReference[] = {-0.006348f, -0.004456f, -0.002808f};
   RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveAnalog, 10, 100, 5,
                       true, 70, 80, kStreamAnalogLevelReference,
                       kOutputReference);
@@ -400,7 +400,7 @@
      DISABLED_Mono16kHz_AdaptiveDigital_Tl10_SL100_CG5_NoLim_AL0_100) {
 #endif
   const int kStreamAnalogLevelReference = 100;
-  const float kOutputReference[] = {-0.004028f, -0.002838f, -0.001801f};
+  const float kOutputReference[] = {-0.006592f, -0.004639f, -0.002930f};
   RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveDigital, 10, 100, 5,
                       false, 0, 100, kStreamAnalogLevelReference,
                       kOutputReference);