Add functions to interact with ASan and MSan, and some sample uses

The sample uses are from when I debugged bug 617124. The change in neteq_network_stats_unittest.cc is a fix for a minor unrelated bug found by the try bots when I tried to land this CL (a test was passing uninitialized packet data to NetEq).

BUG=chromium:617124

Review-Url: https://codereview.webrtc.org/2293893002
Cr-Commit-Position: refs/heads/master@{#14034}
This commit is contained in:
kwiberg
2016-09-02 00:39:33 -07:00
committed by Commit bot
parent 97d2dacf9f
commit ac554eebb9
10 changed files with 145 additions and 2 deletions

View File

@ -10,6 +10,9 @@
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/sanitizer.h"
// TODO(Bjornv): Change the function parameter order to WebRTC code style.
// C version of WebRtcSpl_DownsampleFast() for generic platforms.
int WebRtcSpl_DownsampleFastC(const int16_t* data_in,
@ -20,6 +23,7 @@ int WebRtcSpl_DownsampleFastC(const int16_t* data_in,
size_t coefficients_length,
int factor,
size_t delay) {
int16_t* const original_data_out = data_out;
size_t i = 0;
size_t j = 0;
int32_t out_s32 = 0;
@ -31,10 +35,14 @@ int WebRtcSpl_DownsampleFastC(const int16_t* data_in,
return -1;
}
rtc_MsanCheckInitialized(coefficients, sizeof(coefficients[0]),
coefficients_length);
for (i = delay; i < endpos; i += factor) {
out_s32 = 2048; // Round value, 0.5 in Q12.
for (j = 0; j < coefficients_length; j++) {
rtc_MsanCheckInitialized(&data_in[i - j], sizeof(data_in[0]), 1);
out_s32 += coefficients[j] * data_in[i - j]; // Q12.
}
@ -44,5 +52,9 @@ int WebRtcSpl_DownsampleFastC(const int16_t* data_in,
*data_out++ = WebRtcSpl_SatW32ToW16(out_s32);
}
RTC_DCHECK_EQ(original_data_out + data_out_length, data_out);
rtc_MsanCheckInitialized(original_data_out, sizeof(original_data_out[0]),
data_out_length);
return 0;
}

View File

@ -17,6 +17,8 @@
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
#include "webrtc/base/sanitizer.h"
void WebRtcSpl_FilterMAFastQ12(const int16_t* in_ptr,
int16_t* out_ptr,
const int16_t* B,
@ -24,6 +26,11 @@ void WebRtcSpl_FilterMAFastQ12(const int16_t* in_ptr,
size_t length)
{
size_t i, j;
rtc_MsanCheckInitialized(B, sizeof(B[0]), B_length);
rtc_MsanCheckInitialized(in_ptr - B_length + 1, sizeof(in_ptr[0]),
B_length + length - 1);
for (i = 0; i < length; i++)
{
int32_t o = 0;