/src/curl_fuzzer/fuzzer_entrypoints/curl_fuzzer_proto.cc
Line | Count | Source |
1 | | /* |
2 | | * Copyright (C) Max Dymond, <cmeister2@gmail.com>, et al. |
3 | | * |
4 | | * SPDX-License-Identifier: curl |
5 | | */ |
6 | | |
7 | | #include "generated/compatibility/compatibility_traits.h" |
8 | | #include "proto_fuzzer/fuzzer_main.h" |
9 | | |
10 | | namespace { |
11 | | |
12 | | // Bind this source's visible target identity once so mutation, crossover, and |
13 | | // execution cannot drift onto different policies as the shared runner evolves. |
14 | | using Traits = proto_fuzzer::generated::CompatibilityTraits; |
15 | | constexpr auto kProfile = proto_fuzzer::BindProfileFuzzer<Traits>(); |
16 | | |
17 | | } // namespace |
18 | | |
19 | | // Keep all three libFuzzer ABI hooks in the same-named source. Besides making |
20 | | // the selected profile explicit, this lets Fuzz Introspector attribute the |
21 | | // historical mixed lane independently while the implementation remains shared. |
22 | | extern "C" std::size_t LLVMFuzzerCustomMutator(std::uint8_t *data, |
23 | | std::size_t size, |
24 | | std::size_t max_size, |
25 | 0 | unsigned int seed) { |
26 | 0 | return proto_fuzzer::ProtoFuzzerCustomMutator(data, size, max_size, seed, |
27 | 0 | kProfile); |
28 | 0 | } |
29 | | |
30 | | extern "C" std::size_t |
31 | | LLVMFuzzerCustomCrossOver(const std::uint8_t *data1, std::size_t size1, |
32 | | const std::uint8_t *data2, std::size_t size2, |
33 | | std::uint8_t *out, std::size_t max_out_size, |
34 | 0 | unsigned int seed) { |
35 | 0 | return proto_fuzzer::ProtoFuzzerCustomCrossOver( |
36 | 0 | data1, size1, data2, size2, out, max_out_size, seed, kProfile); |
37 | 0 | } |
38 | | |
39 | | extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, |
40 | 473k | std::size_t size) { |
41 | 473k | return proto_fuzzer::ProtoFuzzerTestOneInput(data, size, kProfile); |
42 | 473k | } |