1 // Copyright 2017 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 "core/fxcrt/fx_string.h" 6 #include "testing/fuzzers/pdfium_fuzzer_util.h" 7 #include "testing/fuzzers/xfa_process_state.h" 8 #include "xfa/fxfa/formcalc/cxfa_fmparser.h" 9 LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)10extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 11 auto* state = static_cast<XFAProcessState*>(FPDF_GetFuzzerPerProcessState()); 12 WideString input = WideString::FromUTF8(ByteStringView(data, size)); 13 CXFA_FMLexer lexer(input.AsStringView()); 14 CXFA_FMParser parser(state->GetHeap(), &lexer); 15 parser.Parse(); 16 state->ForceGCAndPump(); 17 return 0; 18 } 19