1 // Copyright 2019 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <stdint.h>
6
7 #include "cast/streaming/rtp_packet_parser.h"
8
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)9 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
10 using openscreen::cast::RtpPacketParser;
11 using openscreen::cast::Ssrc;
12
13 constexpr Ssrc kSenderSsrcInSeedCorpus = 0x01020304;
14 RtpPacketParser parser(kSenderSsrcInSeedCorpus);
15 parser.Parse(absl::Span<const uint8_t>(data, size));
16
17 return 0;
18 }
19
20 #if defined(NEEDS_MAIN_TO_CALL_FUZZER_DRIVER)
21
22 // Forward declarations of Clang's built-in libFuzzer driver.
23 namespace fuzzer {
24 using TestOneInputCallback = int (*)(const uint8_t* data, size_t size);
25 int FuzzerDriver(int* argc, char*** argv, TestOneInputCallback callback);
26 } // namespace fuzzer
27
main(int argc,char * argv[])28 int main(int argc, char* argv[]) {
29 return fuzzer::FuzzerDriver(&argc, &argv, LLVMFuzzerTestOneInput);
30 }
31
32 #endif // defined(NEEDS_MAIN_TO_CALL_FUZZER_DRIVER)
33