Make UBSan warnings fatal and fix the existing ones

The warnings were (all signed integer overflow):
webrtc/common_audio/signal_processing/levinson_durbin.c:46:25
12 * 268435456 cannot be represented in type 'int'
webrtc/modules/audio_processing/aecm/aecm_core.cc:930:69
522240 * 6115 cannot be represented in type 'int'
webrtc/modules/audio_processing/aecm/aecm_core_c.cc:455:36
72293096 * 50 cannot be represented in type 'int'
webrtc/modules/pacing/alr_detector.cc:70:48
1000000000 * 65 cannot be represented in type 'int'
webrtc/modules/rtp_rtcp/source/rtp_sender.cc:947:20
1929277286 + 321546521 cannot be represented in type 'int'

BUG=webrtc:8195

Review-Url: https://codereview.webrtc.org/3005003002
Cr-Commit-Position: refs/heads/master@{#19670}
This commit is contained in:
oprypin
2017-09-04 08:32:43 -07:00
committed by Commit Bot
parent 9762d4f2e5
commit ba09f79ba3
5 changed files with 16 additions and 9 deletions

View File

@ -24,6 +24,7 @@ extern "C" {
}
#include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/safe_conversions.h"
#include "webrtc/typedefs.h"
#ifdef AEC_DEBUG
@ -927,8 +928,8 @@ void WebRtcAecm_UpdateChannel(AecmCore* aecm,
{
// We need to shift down before multiplication
shiftChFar = 32 - zerosCh - zerosFar;
tmpU32no1 = (aecm->channelAdapt32[i] >> shiftChFar) *
far_spectrum[i];
tmpU32no1 = rtc::dchecked_cast<uint32_t>(
aecm->channelAdapt32[i] >> shiftChFar) * far_spectrum[i];
}
// Determine Q-domain of numerator
zerosNum = WebRtcSpl_NormU32(tmpU32no1);