blob: c5365900390de60e97c1e54e8908c0fa33714811 [file] [log] [blame]
QUICHE teama6ef0a62019-03-07 20:34:33 -05001// Copyright (c) 2019 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
QUICHE teama6ef0a62019-03-07 20:34:33 -05005#include "net/third_party/quiche/src/quic/core/crypto/crypto_framer.h"
6#include "net/third_party/quiche/src/quic/core/crypto/crypto_handshake_message.h"
7#include "net/third_party/quiche/src/quic/core/quic_framer.h"
8#include "net/third_party/quiche/src/quic/core/quic_packets.h"
9#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
10#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
11
12extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
QUICHE teama6ef0a62019-03-07 20:34:33 -050013 quic::QuicFramer framer(quic::AllSupportedVersions(), quic::QuicTime::Zero(),
14 quic::Perspective::IS_SERVER,
15 quic::kQuicDefaultConnectionIdLength);
16 const char* const packet_bytes = reinterpret_cast<const char*>(data);
17
18 // Test the CryptoFramer.
19 quic::QuicStringPiece crypto_input(packet_bytes, size);
20 std::unique_ptr<quic::CryptoHandshakeMessage> handshake_message(
21 quic::CryptoFramer::ParseMessage(crypto_input));
22
23 // Test the regular QuicFramer with the same input.
24 quic::test::NoOpFramerVisitor visitor;
25 framer.set_visitor(&visitor);
26 quic::QuicEncryptedPacket packet(packet_bytes, size);
27 framer.ProcessPacket(packet);
28
29 return 0;
30}