aboutsummaryrefslogtreecommitdiff
path: root/net/dcsctp/fuzzers/dcsctp_fuzzers_test.cc
blob: c7d2cd7c998cc25084d446c9a5f3bd62af94d8fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
 *  Copyright (c) 2021 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */
#include "net/dcsctp/fuzzers/dcsctp_fuzzers.h"

#include "api/array_view.h"
#include "net/dcsctp/packet/sctp_packet.h"
#include "net/dcsctp/public/dcsctp_socket.h"
#include "net/dcsctp/socket/dcsctp_socket.h"
#include "net/dcsctp/testing/testing_macros.h"
#include "rtc_base/gunit.h"
#include "rtc_base/logging.h"
#include "test/gmock.h"

namespace dcsctp {
namespace dcsctp_fuzzers {
namespace {

// This is a testbed where fuzzed data that cause issues can be evaluated and
// crashes reproduced. Use `xxd -i ./crash-abc` to generate `data` below.
TEST(DcsctpFuzzersTest, PassesTestbed) {
  uint8_t data[] = {0x07, 0x09, 0x00, 0x01, 0x11, 0xff, 0xff};

  FuzzerCallbacks cb;
  DcSctpOptions options;
  options.disable_checksum_verification = true;
  DcSctpSocket socket("A", cb, nullptr, options);

  FuzzSocket(socket, cb, data);
}

}  // namespace
}  // namespace dcsctp_fuzzers
}  // namespace dcsctp