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:
@ -461,11 +461,11 @@
|
||||
},
|
||||
|
||||
'ubsan': {
|
||||
'gn_args': 'is_ubsan=true',
|
||||
'gn_args': 'is_ubsan=true is_ubsan_no_recover=true',
|
||||
},
|
||||
|
||||
'ubsan_vptr': {
|
||||
'gn_args': 'is_ubsan_vptr=true',
|
||||
'gn_args': 'is_ubsan_vptr=true is_ubsan_no_recover=true',
|
||||
},
|
||||
|
||||
'win_fastlink': {
|
||||
|
||||
@ -22,6 +22,10 @@ src:*/usr/*
|
||||
# https://bugs.chromium.org/p/webrtc/issues/detail?id=5513
|
||||
fun:*FilterBanksTest*CalculateResidualEnergyTester*
|
||||
|
||||
#############################################################################
|
||||
# https://bugs.chromium.org/p/webrtc/issues/detail?id=8200
|
||||
fun:*WebRtcAecm_ProcessBlock*
|
||||
|
||||
#############################################################################
|
||||
# Ignore errors in common_audio.
|
||||
# https://bugs.chromium.org/p/webrtc/issues/detail?id=5486
|
||||
@ -30,4 +34,5 @@ src:*/webrtc/common_audio/signal_processing/resample_by_2_internal.c
|
||||
fun:*WebRtcSpl_AddSatW32*
|
||||
fun:*WebRtcSpl_SubSatW32*
|
||||
fun:*WebRtcSpl_DivW32HiLow*
|
||||
fun:*WebRtcSpl_LevinsonDurbin*
|
||||
fun:*GmmProbability*
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -67,8 +67,9 @@ void AlrDetector::OnBytesSent(size_t bytes_sent, int64_t delta_time_ms) {
|
||||
|
||||
void AlrDetector::SetEstimatedBitrate(int bitrate_bps) {
|
||||
RTC_DCHECK(bitrate_bps);
|
||||
alr_budget_.set_target_rate_kbps(bitrate_bps * bandwidth_usage_percent_ /
|
||||
(1000 * 100));
|
||||
const auto target_rate_kbps = int64_t{bitrate_bps} *
|
||||
bandwidth_usage_percent_ / (1000 * 100);
|
||||
alr_budget_.set_target_rate_kbps(rtc::dchecked_cast<int>(target_rate_kbps));
|
||||
}
|
||||
|
||||
rtc::Optional<int64_t> AlrDetector::GetApplicationLimitedRegionStartTime()
|
||||
|
||||
@ -936,7 +936,7 @@ void RTPSender::UpdateDelayStatistics(int64_t capture_time_ms, int64_t now_ms) {
|
||||
return;
|
||||
|
||||
uint32_t ssrc;
|
||||
int avg_delay_ms = 0;
|
||||
int64_t avg_delay_ms = 0;
|
||||
int max_delay_ms = 0;
|
||||
{
|
||||
rtc::CritScope lock(&send_critsect_);
|
||||
@ -962,8 +962,8 @@ void RTPSender::UpdateDelayStatistics(int64_t capture_time_ms, int64_t now_ms) {
|
||||
return;
|
||||
avg_delay_ms = (avg_delay_ms + num_delays / 2) / num_delays;
|
||||
}
|
||||
send_side_delay_observer_->SendSideDelayUpdated(avg_delay_ms, max_delay_ms,
|
||||
ssrc);
|
||||
send_side_delay_observer_->SendSideDelayUpdated(
|
||||
rtc::dchecked_cast<int>(avg_delay_ms), max_delay_ms, ssrc);
|
||||
}
|
||||
|
||||
void RTPSender::UpdateOnSendPacket(int packet_id,
|
||||
|
||||
Reference in New Issue
Block a user