| OLD | NEW |
| (Empty) | |
| 1 /* |
| 2 * Copyright (c) 2016 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 |
| 11 #include <bitset> |
| 12 |
| 13 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h" |
| 14 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 15 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
| 16 |
| 17 namespace webrtc { |
| 18 void FuzzOneInput(const uint8_t* data, size_t size) { |
| 19 if (size <= 1) |
| 20 return; |
| 21 |
| 22 // We decide which header extensions to register by reading one byte |
| 23 // from the beginning of |data| and interpreting it as a bitmask |
| 24 // over the RTPExtensionType enum. That byte shouldn't also be part |
| 25 // of the packet, so we adjust |data| and |size| to remove it. |
| 26 std::bitset<8> extensionMask(data[0]); |
| 27 data++; |
| 28 size--; |
| 29 |
| 30 RtpPacketReceived::ExtensionManager extensions; |
| 31 for (int i = 1; i <= kRtpExtensionNumberOfExtensions; i++) { |
| 32 // Skip i=0 which is kRtpExtensionNone i.e. not an actual extension. |
| 33 if (extensionMask[i]) { |
| 34 // We use i as the ID; it's used in negotiation so not relevant. |
| 35 extensions.Register(static_cast<RTPExtensionType>(i), i); |
| 36 } |
| 37 } |
| 38 |
| 39 RTPHeader rtp_header; |
| 40 RtpUtility::RtpHeaderParser rtp_parser(data, size); |
| 41 rtp_parser.Parse(&rtp_header, &extensions); |
| 42 } |
| 43 } // namespace webrtc |
| OLD | NEW |