From ddfd9c5fd2236c426aead743cc884898fde24f5e Mon Sep 17 00:00:00 2001 From: Alex Loiko Date: Wed, 25 Oct 2017 12:58:46 +0200 Subject: [PATCH] Fix AudioProcessing fuzzer crash. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Commit-Queue: Alex Loiko Cr-Commit-Position: refs/heads/master@{#20428} --- test/fuzzers/audio_processing_fuzzer.cc | 3 +-- test/fuzzers/audio_processing_fuzzer_configs.cc | 9 ++++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/test/fuzzers/audio_processing_fuzzer.cc b/test/fuzzers/audio_processing_fuzzer.cc index 9faea41fa2..9879106f54 100644 --- a/test/fuzzers/audio_processing_fuzzer.cc +++ b/test/fuzzers/audio_processing_fuzzer.cc @@ -24,8 +24,7 @@ size_t ByteToNativeRate(uint8_t data) { using Rate = AudioProcessing::NativeRate; switch (data % 4) { case 0: - // Breaks AEC3. - // return static_cast(Rate::kSampleRate8kHz); + return static_cast(Rate::kSampleRate8kHz); case 1: return static_cast(Rate::kSampleRate16kHz); case 2: diff --git a/test/fuzzers/audio_processing_fuzzer_configs.cc b/test/fuzzers/audio_processing_fuzzer_configs.cc index ed34c35703..15e0beeba9 100644 --- a/test/fuzzers/audio_processing_fuzzer_configs.cc +++ b/test/fuzzers/audio_processing_fuzzer_configs.cc @@ -45,6 +45,11 @@ std::unique_ptr 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 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