diff --git a/webrtc/test/fuzzers/BUILD.gn b/webrtc/test/fuzzers/BUILD.gn index c1b9ed9985..9179d05cc5 100644 --- a/webrtc/test/fuzzers/BUILD.gn +++ b/webrtc/test/fuzzers/BUILD.gn @@ -7,8 +7,9 @@ # be found in the AUTHORS file in the root of the source tree. import("//build/config/features.gni") -import("//testing/test.gni") +import("//build_overrides/webrtc.gni") import("//testing/libfuzzer/fuzzer_test.gni") +import("//testing/test.gni") static_library("webrtc_fuzzer_main") { public_configs = [ "../..:common_inherited_config" ] @@ -175,3 +176,17 @@ webrtc_fuzzer_test("audio_decoder_opus_redundant_fuzzer") { "../../modules/audio_coding:webrtc_opus", ] } + +# TODO(katrielc) Enable in Chromium when CL 2022833002 lands. +# Although the dependency on media compiles in standalone, it is +# flagged by gn check, so breaks when rolled into Chromium. +if (!build_with_chromium) { + webrtc_fuzzer_test("turn_unwrap_fuzzer") { + sources = [ + "turn_unwrap_fuzzer.cc", + ] + deps = [ + "../../media:media", + ] + } +} diff --git a/webrtc/test/fuzzers/turn_unwrap_fuzzer.cc b/webrtc/test/fuzzers/turn_unwrap_fuzzer.cc new file mode 100644 index 0000000000..818fbe9080 --- /dev/null +++ b/webrtc/test/fuzzers/turn_unwrap_fuzzer.cc @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#include +#include + +#include "webrtc/media/base/turnutils.h" + +namespace webrtc { +void FuzzOneInput(const uint8_t* data, size_t size) { + size_t content_position; + size_t content_size; + cricket::UnwrapTurnPacket(data, size, &content_position, &content_size); +} +} // namespace webrtc