xref: /aosp_15_r20/external/zucchini/fuzzers/patch_fuzzer.cc (revision a03ca8b91e029cd15055c20c78c2e087c84792e4)
1 // Copyright 2017 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 <optional>
9 
10 #include "components/zucchini/buffer_view.h"
11 #include "components/zucchini/patch_reader.h"
12 
13 // Entry point for LibFuzzer.
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)14 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
15   logging::SetMinLogLevel(3);  // Disable console spamming.
16   zucchini::ConstBufferView patch(data, size);
17   std::optional<zucchini::EnsemblePatchReader> patch_reader =
18       zucchini::EnsemblePatchReader::Create(patch);
19   return 0;
20 }
21