xref: /aosp_15_r20/external/zucchini/fuzzers/patch_fuzzer.cc (revision a03ca8b91e029cd15055c20c78c2e087c84792e4)
1*a03ca8b9SKrzysztof Kosiński // Copyright 2017 The Chromium Authors. All rights reserved.
2*a03ca8b9SKrzysztof Kosiński // Use of this source code is governed by a BSD-style license that can be
3*a03ca8b9SKrzysztof Kosiński // found in the LICENSE file.
4*a03ca8b9SKrzysztof Kosiński 
5*a03ca8b9SKrzysztof Kosiński #include <stddef.h>
6*a03ca8b9SKrzysztof Kosiński #include <stdint.h>
7*a03ca8b9SKrzysztof Kosiński 
8*a03ca8b9SKrzysztof Kosiński #include <optional>
9*a03ca8b9SKrzysztof Kosiński 
10*a03ca8b9SKrzysztof Kosiński #include "components/zucchini/buffer_view.h"
11*a03ca8b9SKrzysztof Kosiński #include "components/zucchini/patch_reader.h"
12*a03ca8b9SKrzysztof Kosiński 
13*a03ca8b9SKrzysztof Kosiński // Entry point for LibFuzzer.
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)14*a03ca8b9SKrzysztof Kosiński extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
15*a03ca8b9SKrzysztof Kosiński   logging::SetMinLogLevel(3);  // Disable console spamming.
16*a03ca8b9SKrzysztof Kosiński   zucchini::ConstBufferView patch(data, size);
17*a03ca8b9SKrzysztof Kosiński   std::optional<zucchini::EnsemblePatchReader> patch_reader =
18*a03ca8b9SKrzysztof Kosiński       zucchini::EnsemblePatchReader::Create(patch);
19*a03ca8b9SKrzysztof Kosiński   return 0;
20*a03ca8b9SKrzysztof Kosiński }
21