Peter Boström | ba3e25e | 2016-02-23 11:35:30 +0100 | [diff] [blame] | 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 | */ |
Mirko Bonadei | 3b67672 | 2019-07-12 17:35:05 +0000 | [diff] [blame] | 10 | #include "modules/rtp_rtcp/include/rtp_rtcp.h" |
Jonathan Metzman | 9f80b97 | 2018-10-05 10:38:13 -0700 | [diff] [blame] | 11 | #include "modules/rtp_rtcp/source/rtcp_packet/tmmb_item.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 12 | #include "modules/rtp_rtcp/source/rtcp_receiver.h" |
| 13 | #include "rtc_base/checks.h" |
| 14 | #include "system_wrappers/include/clock.h" |
Peter Boström | ba3e25e | 2016-02-23 11:35:30 +0100 | [diff] [blame] | 15 | |
| 16 | namespace webrtc { |
Danil Chapovalov | 9708884 | 2016-09-13 12:41:41 +0200 | [diff] [blame] | 17 | namespace { |
| 18 | |
Jiawei Ou | 8b5d9d8 | 2018-11-15 16:44:37 -0800 | [diff] [blame] | 19 | constexpr int kRtcpIntervalMs = 1000; |
| 20 | |
Elad Alon | 800a103 | 2019-04-07 23:50:08 +0200 | [diff] [blame] | 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 | |
Danil Chapovalov | 9708884 | 2016-09-13 12:41:41 +0200 | [diff] [blame] | 25 | class NullModuleRtpRtcp : public RTCPReceiver::ModuleRtpRtcp { |
| 26 | public: |
| 27 | void SetTmmbn(std::vector<rtcp::TmmbItem>) override {} |
| 28 | void OnRequestSendReport() override {} |
Nico Weber | 7572bb4 | 2019-02-25 11:39:52 -0500 | [diff] [blame] | 29 | void OnReceivedNack(const std::vector<uint16_t>&) override {} |
| 30 | void OnReceivedRtcpReportBlocks(const ReportBlockList&) override {} |
Danil Chapovalov | 9708884 | 2016-09-13 12:41:41 +0200 | [diff] [blame] | 31 | }; |
| 32 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 33 | } // namespace |
Peter Boström | ba3e25e | 2016-02-23 11:35:30 +0100 | [diff] [blame] | 34 | |
| 35 | void FuzzOneInput(const uint8_t* data, size_t size) { |
Elad Alon | 800a103 | 2019-04-07 23:50:08 +0200 | [diff] [blame] | 36 | if (size > kMaxInputLenBytes) { |
| 37 | return; |
| 38 | } |
| 39 | |
Danil Chapovalov | 9708884 | 2016-09-13 12:41:41 +0200 | [diff] [blame] | 40 | NullModuleRtpRtcp rtp_rtcp_module; |
| 41 | SimulatedClock clock(1234); |
Peter Boström | ba3e25e | 2016-02-23 11:35:30 +0100 | [diff] [blame] | 42 | |
Mirko Bonadei | 3b67672 | 2019-07-12 17:35:05 +0000 | [diff] [blame] | 43 | RtpRtcp::Configuration config; |
| 44 | config.clock = &clock; |
| 45 | config.rtcp_report_interval_ms = kRtcpIntervalMs; |
Erik Språng | dbbf413 | 2019-10-18 10:34:25 +0200 | [diff] [blame^] | 46 | config.local_media_ssrc = 1; |
Mirko Bonadei | 3b67672 | 2019-07-12 17:35:05 +0000 | [diff] [blame] | 47 | |
| 48 | RTCPReceiver receiver(config, &rtp_rtcp_module); |
Peter Boström | ba3e25e | 2016-02-23 11:35:30 +0100 | [diff] [blame] | 49 | |
Danil Chapovalov | 9708884 | 2016-09-13 12:41:41 +0200 | [diff] [blame] | 50 | receiver.IncomingPacket(data, size); |
Peter Boström | ba3e25e | 2016-02-23 11:35:30 +0100 | [diff] [blame] | 51 | } |
| 52 | } // namespace webrtc |