xref: /aosp_15_r20/external/pdfium/testing/fuzzers/pdfium_fuzzer_util.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2019 The PDFium 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 #ifndef TESTING_FUZZERS_PDFIUM_FUZZER_UTIL_H_
6 #define TESTING_FUZZERS_PDFIUM_FUZZER_UTIL_H_
7 
8 #include <stdint.h>
9 
10 #include "public/fpdfview.h"
11 
12 // Returns an integer from the first 4 bytes of |data|.
13 int GetInteger(const uint8_t* data);
14 
15 // Plumb access to any context created by fuzzer initialization into
16 // the LLVMFuzzerTestOneInput() function, as that function does not
17 // allow for additional parameters, nor can it reach back up to the
18 // top-level fuzzer shim during a component build (see the comment
19 // in BUILD.gn about splitting fuzzers into _impl and _src targets).
20 extern "C" {
21 FPDF_EXPORT void FPDF_CALLCONV FPDF_SetFuzzerPerProcessState(void* state);
22 FPDF_EXPORT void* FPDF_CALLCONV FPDF_GetFuzzerPerProcessState();
23 }  // extern "C"
24 
25 #endif  // TESTING_FUZZERS_PDFIUM_FUZZER_UTIL_H_
26