From d6c4b80268d3e29f20c64ae20fa03a435a5831a6 Mon Sep 17 00:00:00 2001 From: Benjamin Wright Date: Tue, 12 Mar 2019 17:00:25 -0700 Subject: [PATCH] Add Fuzzing support for ParseRtcpPacketSenderSsrc. This function is called on each incoming RTCP payload. Bug: webrtc:10395 Change-Id: I164746fe45912cc503565e77046b5d884e0204e6 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/127122 Commit-Queue: Benjamin Wright Reviewed-by: Qingsi Wang Cr-Commit-Position: refs/heads/master@{#27110} --- test/fuzzers/BUILD.gn | 11 +++++++++ .../fuzzers/rtp_rtcp_demuxer_helper_fuzzer.cc | 23 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 test/fuzzers/rtp_rtcp_demuxer_helper_fuzzer.cc diff --git a/test/fuzzers/BUILD.gn b/test/fuzzers/BUILD.gn index 290db38e39..797f270483 100644 --- a/test/fuzzers/BUILD.gn +++ b/test/fuzzers/BUILD.gn @@ -587,3 +587,14 @@ webrtc_fuzzer_test("string_to_number_fuzzer") { ] seed_corpus = "corpora/string_to_number-corpus" } + +webrtc_fuzzer_test("rtp_rtcp_demuxer_helper_fuzzer") { + sources = [ + "rtp_rtcp_demuxer_helper_fuzzer.cc", + ] + deps = [ + "../../api:array_view", + "../../call:rtp_receiver", + ] + seed_corpus = "corpora/rtcp-corpus" +} diff --git a/test/fuzzers/rtp_rtcp_demuxer_helper_fuzzer.cc b/test/fuzzers/rtp_rtcp_demuxer_helper_fuzzer.cc new file mode 100644 index 0000000000..f7403b9567 --- /dev/null +++ b/test/fuzzers/rtp_rtcp_demuxer_helper_fuzzer.cc @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2019 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 "call/rtp_rtcp_demuxer_helper.h" + +namespace webrtc { + +void FuzzOneInput(const uint8_t* data, size_t size) { + ParseRtcpPacketSenderSsrc(rtc::MakeArrayView(data, size)); +} + +} // namespace webrtc