From adacadb6787e8431efe0d66b57c814fe431f8936 Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Fri, 13 Dec 2024 07:46:49 -0800 Subject: [PATCH] fuzzers: add DTLS fuzzer to fuzz the code parsing DTLS packets for DTLS-STUN piggybacking BUG=webrtc:367395350 Change-Id: Ifa1a52ef56b322e465604e8d49ae18e5dc27613f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/371360 Reviewed-by: Jonas Oreland Reviewed-by: Danil Chapovalov Commit-Queue: Philipp Hancke Cr-Commit-Position: refs/heads/main@{#43562} --- test/fuzzers/BUILD.gn | 11 +++++++++++ test/fuzzers/DEPS | 1 + test/fuzzers/dtls_utils_fuzzer.cc | 21 +++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 test/fuzzers/dtls_utils_fuzzer.cc diff --git a/test/fuzzers/BUILD.gn b/test/fuzzers/BUILD.gn index 65e460a303..8e3bdcd423 100644 --- a/test/fuzzers/BUILD.gn +++ b/test/fuzzers/BUILD.gn @@ -102,6 +102,17 @@ webrtc_fuzzer_test("vp9_depacketizer_fuzzer") { ] } +webrtc_fuzzer_test("dtls_utils_fuzzer") { + sources = [ "dtls_utils_fuzzer.cc" ] + deps = [ + "../../api:array_view", + "../../p2p:dtls_utils", + ] + + # Seed from boringssl DTLS corpus. + seed_corpus = "../../third_party/boringssl/src/fuzz/dtls_client_corpus" +} + webrtc_fuzzer_test("vp8_qp_parser_fuzzer") { sources = [ "vp8_qp_parser_fuzzer.cc" ] deps = [ diff --git a/test/fuzzers/DEPS b/test/fuzzers/DEPS index 50b1c8adce..ce07bcbe6c 100644 --- a/test/fuzzers/DEPS +++ b/test/fuzzers/DEPS @@ -2,4 +2,5 @@ include_rules = [ "+audio", "+pc", "+net/dcsctp", + "+p2p", ] diff --git a/test/fuzzers/dtls_utils_fuzzer.cc b/test/fuzzers/dtls_utils_fuzzer.cc new file mode 100644 index 0000000000..8a4f9e074a --- /dev/null +++ b/test/fuzzers/dtls_utils_fuzzer.cc @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2024 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 "api/array_view.h" +#include "p2p/dtls/dtls_utils.h" + +namespace webrtc { +void FuzzOneInput(const uint8_t* data, size_t size) { + cricket::GetDtlsHandshakeAcks(rtc::MakeArrayView(data, size)); +} + +} // namespace webrtc