Fix AudioProcessing fuzzer crash.

When audio_processing_fuzzer runs with 'DCHECK_ALWAYS_ON', it crashes
when both AEC and AECM is enabled at the same time. This change
detects that case and fixes
https://clusterfuzz.com/v2/testcase-detail/6389429496446976.

It also removes an unnecessary safeguard that didn't allow fuzzing
with 8kHz input signals.

Bug: chromium:776358
Change-Id: I33c18a2a235e50ae410f7be24637872823e432eb
Reviewed-on: https://webrtc-review.googlesource.com/15320
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20428}
This commit is contained in:
Alex Loiko 2017-10-25 12:58:46 +02:00 committed by Commit Bot
parent ef52d8b859
commit ddfd9c5fd2
2 changed files with 9 additions and 3 deletions

View File

@ -24,8 +24,7 @@ size_t ByteToNativeRate(uint8_t data) {
using Rate = AudioProcessing::NativeRate;
switch (data % 4) {
case 0:
// Breaks AEC3.
// return static_cast<size_t>(Rate::kSampleRate8kHz);
return static_cast<size_t>(Rate::kSampleRate8kHz);
case 1:
return static_cast<size_t>(Rate::kSampleRate16kHz);
case 2:

View File

@ -45,6 +45,11 @@ std::unique_ptr<AudioProcessing> CreateAPM(const uint8_t** data,
return nullptr;
}
// Filter out incompatible settings that lead to CHECK failures.
if (*use_aecm && *use_aec) {
return nullptr;
}
// Components can be enabled through webrtc::Config and
// webrtc::AudioProcessingConfig.
Config config;
@ -87,6 +92,8 @@ std::unique_ptr<AudioProcessing> CreateAPM(const uint8_t** data,
void FuzzOneInput(const uint8_t* data, size_t size) {
auto apm = CreateAPM(&data, &size);
FuzzAudioProcessing(data, size, std::move(apm));
if (apm) {
FuzzAudioProcessing(data, size, std::move(apm));
}
}
} // namespace webrtc