xref: /aosp_15_r20/external/pdfium/testing/fuzzers/component_fuzzer_template.cc (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 #include <stddef.h>
6*3ac0a46fSAndroid Build Coastguard Worker #include <stdint.h>
7*3ac0a46fSAndroid Build Coastguard Worker 
8*3ac0a46fSAndroid Build Coastguard Worker #include "public/fpdfview.h"
9*3ac0a46fSAndroid Build Coastguard Worker 
10*3ac0a46fSAndroid Build Coastguard Worker // This template is used in component builds to forward to the real fuzzers
11*3ac0a46fSAndroid Build Coastguard Worker // which are exported from the PDFium shared library.
12*3ac0a46fSAndroid Build Coastguard Worker 
13*3ac0a46fSAndroid Build Coastguard Worker // FUZZER_IMPL is a macro defined at build time that contains the name of the
14*3ac0a46fSAndroid Build Coastguard Worker // real fuzzer.
15*3ac0a46fSAndroid Build Coastguard Worker extern "C" FPDF_EXPORT int FUZZER_IMPL(const uint8_t* data, size_t size);
16*3ac0a46fSAndroid Build Coastguard Worker 
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)17*3ac0a46fSAndroid Build Coastguard Worker extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
18*3ac0a46fSAndroid Build Coastguard Worker   return FUZZER_IMPL(data, size);
19*3ac0a46fSAndroid Build Coastguard Worker }
20