xref: /aosp_15_r20/external/pdfium/testing/fuzzers/pdfium_fuzzer_util.cc (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 #include "testing/fuzzers/pdfium_fuzzer_util.h"
6 
7 namespace {
8 void* g_fuzzer_init_per_process_state = nullptr;
9 }  // namespace
10 
GetInteger(const uint8_t * data)11 int GetInteger(const uint8_t* data) {
12   return data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
13 }
14 
FPDF_SetFuzzerPerProcessState(void * state)15 FPDF_EXPORT void FPDF_CALLCONV FPDF_SetFuzzerPerProcessState(void* state) {
16   g_fuzzer_init_per_process_state = state;
17 }
18 
FPDF_GetFuzzerPerProcessState()19 FPDF_EXPORT void* FPDF_CALLCONV FPDF_GetFuzzerPerProcessState() {
20   return g_fuzzer_init_per_process_state;
21 }
22