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