xref: /aosp_15_r20/external/webrtc/test/fuzzers/dcsctp_socket_fuzzer.cc (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2021 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 #include "net/dcsctp/fuzzers/dcsctp_fuzzers.h"
11 #include "net/dcsctp/public/dcsctp_message.h"
12 #include "net/dcsctp/public/dcsctp_options.h"
13 #include "net/dcsctp/public/dcsctp_socket.h"
14 #include "net/dcsctp/socket/dcsctp_socket.h"
15 #include "rtc_base/logging.h"
16 
17 namespace webrtc {
18 
FuzzOneInput(const uint8_t * data,size_t size)19 void FuzzOneInput(const uint8_t* data, size_t size) {
20   dcsctp::dcsctp_fuzzers::FuzzerCallbacks cb;
21   dcsctp::DcSctpOptions options;
22   options.disable_checksum_verification = true;
23   dcsctp::DcSctpSocket socket("A", cb, nullptr, options);
24 
25   dcsctp::dcsctp_fuzzers::FuzzSocket(socket, cb,
26                                      rtc::ArrayView<const uint8_t>(data, size));
27 }
28 }  // namespace webrtc
29