blob: f674ac2f353903c9d6239eff2334355641572f25 [file] [log] [blame]
btolsch7ebfd23c2018-11-16 00:05:101// Copyright 2018 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 <stddef.h>
6#include <stdint.h>
7
Max Moroza1707f42019-08-28 21:10:288#include <fuzzer/FuzzedDataProvider.h>
9
Max Morozc416f802018-11-21 22:15:4210#include <vector>
11
Victor Vasiliev6bb59d22019-03-08 21:34:5112#include "net/third_party/quiche/src/quic/core/crypto/transport_parameters.h"
btolsch7ebfd23c2018-11-16 00:05:1013
14// Entry point for LibFuzzer.
15extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
Max Morozcfbe47cc2019-06-24 17:45:0216 FuzzedDataProvider data_provider(data, size);
btolsch7ebfd23c2018-11-16 00:05:1017 auto perspective = data_provider.ConsumeBool() ? quic::Perspective::IS_CLIENT
18 : quic::Perspective::IS_SERVER;
19 quic::TransportParameters transport_parameters;
Max Morozcfbe47cc2019-06-24 17:45:0220 std::vector<uint8_t> remaining_bytes =
21 data_provider.ConsumeRemainingBytes<uint8_t>();
Fan Yang2330d182019-08-05 14:50:5022 quic::ParseTransportParameters(
23 quic::ParsedQuicVersion(quic::PROTOCOL_TLS1_3, quic::QUIC_VERSION_99),
24 perspective, remaining_bytes.data(), remaining_bytes.size(),
25 &transport_parameters);
btolsch7ebfd23c2018-11-16 00:05:1026 return 0;
27}