xref: /aosp_15_r20/external/webrtc/test/fuzzers/aec3_config_json_fuzzer.cc (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2019 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #include <string>
12 
13 #include "api/audio/echo_canceller3_config.h"
14 #include "api/audio/echo_canceller3_config_json.h"
15 #include "test/fuzzers/fuzz_data_helper.h"
16 
17 namespace webrtc {
FuzzOneInput(const uint8_t * data,size_t size)18 void FuzzOneInput(const uint8_t* data, size_t size) {
19   if (size > 10000) {
20     return;
21   }
22   std::string config_json(reinterpret_cast<const char*>(data), size);
23 
24   EchoCanceller3Config config;
25   bool success;
26   Aec3ConfigFromJsonString(config_json, &config, &success);
27   EchoCanceller3Config::Validate(&config);
28 }
29 
30 }  // namespace webrtc
31