xref: /aosp_15_r20/external/flatbuffers/tests/fuzzer/flexbuffers_verifier_fuzzer.cc (revision 890232f25432b36107d06881e0a25aaa6b473652)
1 // Copyright 2015 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 #include <stddef.h>
5 #include <stdint.h>
6 #include <string>
7 
8 #include "flatbuffers/flexbuffers.h"
9 
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)10 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
11   std::vector<uint8_t> reuse_tracker;
12   // Check both with and without reuse tracker paths.
13   flexbuffers::VerifyBuffer(data, size, &reuse_tracker);
14   // FIXME: we can't really verify this path, because the fuzzer will
15   // construct buffers that time out.
16   // Add a simple #define to bound the number of steps just for the fuzzer?
17   //flexbuffers::VerifyBuffer(data, size, nullptr);
18   return 0;
19 }
20