blob: 52016bdc25aa2305a2c40cf5de4565e058587741 [file] [log] [blame]
Adam Ricea2776b52025-03-05 05:21:561// Copyright 2025 The Chromium Authors
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 "net/base/pickle.h"
6
7#include <stdint.h>
8
9#include <optional>
10#include <set>
11#include <string>
12#include <tuple>
13#include <vector>
14
15#include "base/compiler_specific.h"
16
17namespace net {
18
19namespace {
20
21// See comment in pickle_unittest.cc for the justification for this type.
22using FuzzType = std::set<std::tuple<bool,
23 std::optional<int>,
24 std::vector<std::string>,
25 std::vector<uint16_t>>>;
26
27} // namespace
28
29extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
30 // SAFETY: The fuzzer contract guarantees that `data` points to at least
31 // `size` bytes.
32 auto pickle =
33 base::Pickle::WithUnownedBuffer(UNSAFE_BUFFERS(base::span(data, size)));
34 auto result = ReadValueFromPickle<FuzzType>(pickle);
35 return 0;
36}
37
38} // namespace net