blob: cc020792b131c53dde0201fba8007595ff9329a6 [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 Morozc416f802018-11-21 22:15:428#include <vector>
9
btolsch7ebfd23c2018-11-16 00:05:1010#include "base/test/fuzzed_data_provider.h"
11#include "net/third_party/quic/core/crypto/transport_parameters.h"
12
13// Entry point for LibFuzzer.
14extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
15 base::FuzzedDataProvider data_provider(data, size);
16 auto perspective = data_provider.ConsumeBool() ? quic::Perspective::IS_CLIENT
17 : quic::Perspective::IS_SERVER;
18 quic::TransportParameters transport_parameters;
Max Morozc416f802018-11-21 22:15:4219 std::vector<uint8_t> remaining_bytes = data_provider.ConsumeRemainingBytes();
20 quic::ParseTransportParameters(remaining_bytes.data(), remaining_bytes.size(),
21 perspective, &transport_parameters);
btolsch7ebfd23c2018-11-16 00:05:1022 return 0;
23}