Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: webrtc/test/fuzzers/rtp_header_fuzzer.cc

Issue 2062103002: Add a libfuzzer for RtpHeaderParser. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 // We decide which header extensions to register by reading one byte
20 // from the beginning of |data| and interpreting it as a bitmask over
21 // the RTPExtensionType enum.
22 if (size <= 1)
23 return;
24 size--;
phoglund 2016/06/15 08:20:25 Why is size decreased here? Because you're steppin
katrielc 2016/06/15 09:05:30 Done.
25 std::bitset<8> extensionMask((data++)[0]);
26
27 RtpPacketReceived::ExtensionManager extensions;
28 for (int i = 0; i < kNumberOfRtpHeaderExtensions; i++)
29 if (extensionMask[i])
phoglund 2016/06/15 08:20:25 Nit: use { } since body is more than one line (eve
katrielc 2016/06/15 09:05:30 Done.
30 // We use i as the ID; it's used in negotiation so not relevant.
31 extensions.Register(static_cast<RTPExtensionType>(i), i);
32
33 RTPHeader rtp_header;
34 RtpUtility::RtpHeaderParser rtp_parser(data, size);
35 rtp_parser.Parse(&rtp_header, &extensions);
36 }
37 } // namespace webrtc
OLDNEW
« webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h ('K') | « webrtc/test/fuzzers/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698