blob: f729e55f13cb08de3be79e3cdf4d0e3c1fefe06d [file] [log] [blame]
Peter Boströmba3e25e2016-02-23 11:35:30 +01001/*
2 * Copyright (c) 2015 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 */
Jonathan Metzman9f80b972018-10-05 10:38:13 -070010#include "modules/rtp_rtcp/source/rtcp_packet/tmmb_item.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#include "modules/rtp_rtcp/source/rtcp_receiver.h"
12#include "rtc_base/checks.h"
13#include "system_wrappers/include/clock.h"
Peter Boströmba3e25e2016-02-23 11:35:30 +010014
15namespace webrtc {
Danil Chapovalov97088842016-09-13 12:41:41 +020016namespace {
17
Jiawei Ou8b5d9d82018-11-15 16:44:37 -080018constexpr int kRtcpIntervalMs = 1000;
19
Elad Alon800a1032019-04-07 23:50:08 +020020// RTCP is typically sent over UDP, which has a maximum payload length
21// of 65535 bytes. We err on the side of caution and check a bit above that.
22constexpr size_t kMaxInputLenBytes = 66000;
23
Danil Chapovalov97088842016-09-13 12:41:41 +020024class NullModuleRtpRtcp : public RTCPReceiver::ModuleRtpRtcp {
25 public:
26 void SetTmmbn(std::vector<rtcp::TmmbItem>) override {}
27 void OnRequestSendReport() override {}
Nico Weber7572bb42019-02-25 11:39:52 -050028 void OnReceivedNack(const std::vector<uint16_t>&) override {}
29 void OnReceivedRtcpReportBlocks(const ReportBlockList&) override {}
Danil Chapovalov97088842016-09-13 12:41:41 +020030};
31
Yves Gerey665174f2018-06-19 15:03:05 +020032} // namespace
Peter Boströmba3e25e2016-02-23 11:35:30 +010033
34void FuzzOneInput(const uint8_t* data, size_t size) {
Elad Alon800a1032019-04-07 23:50:08 +020035 if (size > kMaxInputLenBytes) {
36 return;
37 }
38
Danil Chapovalov97088842016-09-13 12:41:41 +020039 NullModuleRtpRtcp rtp_rtcp_module;
40 SimulatedClock clock(1234);
Peter Boströmba3e25e2016-02-23 11:35:30 +010041
Peter Boströmba3e25e2016-02-23 11:35:30 +010042 RTCPReceiver receiver(&clock, false, nullptr, nullptr, nullptr, nullptr,
Jiawei Ou8b5d9d82018-11-15 16:44:37 -080043 nullptr, kRtcpIntervalMs, &rtp_rtcp_module);
Peter Boströmba3e25e2016-02-23 11:35:30 +010044
Danil Chapovalov97088842016-09-13 12:41:41 +020045 receiver.IncomingPacket(data, size);
Peter Boströmba3e25e2016-02-23 11:35:30 +010046}
47} // namespace webrtc