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