1 /* 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 */ 10 #include "modules/rtp_rtcp/source/rtcp_packet/tmmb_item.h" 11 #include "modules/rtp_rtcp/source/rtcp_receiver.h" 12 #include "modules/rtp_rtcp/source/rtp_rtcp_interface.h" 13 #include "rtc_base/checks.h" 14 #include "system_wrappers/include/clock.h" 15 16 namespace webrtc { 17 namespace { 18 19 constexpr int kRtcpIntervalMs = 1000; 20 21 // RTCP is typically sent over UDP, which has a maximum payload length 22 // of 65535 bytes. We err on the side of caution and check a bit above that. 23 constexpr size_t kMaxInputLenBytes = 66000; 24 25 class NullModuleRtpRtcp : public RTCPReceiver::ModuleRtpRtcp { 26 public: SetTmmbn(std::vector<rtcp::TmmbItem>)27 void SetTmmbn(std::vector<rtcp::TmmbItem>) override {} OnRequestSendReport()28 void OnRequestSendReport() override {} OnReceivedNack(const std::vector<uint16_t> &)29 void OnReceivedNack(const std::vector<uint16_t>&) override {} OnReceivedRtcpReportBlocks(const ReportBlockList &)30 void OnReceivedRtcpReportBlocks(const ReportBlockList&) override {} 31 }; 32 33 } // namespace 34 FuzzOneInput(const uint8_t * data,size_t size)35void FuzzOneInput(const uint8_t* data, size_t size) { 36 if (size > kMaxInputLenBytes) { 37 return; 38 } 39 40 NullModuleRtpRtcp rtp_rtcp_module; 41 SimulatedClock clock(1234); 42 43 RtpRtcpInterface::Configuration config; 44 config.clock = &clock; 45 config.rtcp_report_interval_ms = kRtcpIntervalMs; 46 config.local_media_ssrc = 1; 47 48 RTCPReceiver receiver(config, &rtp_rtcp_module); 49 50 receiver.IncomingPacket(data, size); 51 } 52 } // namespace webrtc 53