btolsch | 7ebfd23c | 2018-11-16 00:05:10 | [diff] [blame] | 1 | // 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 | |
| 8 | #include "base/test/fuzzed_data_provider.h" |
| 9 | #include "net/third_party/quic/core/crypto/transport_parameters.h" |
| 10 | |
| 11 | // Entry point for LibFuzzer. |
| 12 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
| 13 | base::FuzzedDataProvider data_provider(data, size); |
| 14 | auto perspective = data_provider.ConsumeBool() ? quic::Perspective::IS_CLIENT |
| 15 | : quic::Perspective::IS_SERVER; |
| 16 | quic::TransportParameters transport_parameters; |
| 17 | std::string remaining_bytes = data_provider.ConsumeRemainingBytes(); |
| 18 | quic::ParseTransportParameters( |
| 19 | reinterpret_cast<const uint8_t*>(remaining_bytes.data()), |
| 20 | remaining_bytes.size(), perspective, &transport_parameters); |
| 21 | return 0; |
| 22 | } |