1 // Copyright 2016 The PDFium Authors. All rights reserved. 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 <cstddef> 6 #include <cstdint> 7 8 #include "core/fxcrt/fx_basic.h" 9 #include "core/fxcrt/fx_safe_types.h" 10 #include "core/fxcrt/fx_string.h" 11 #include "xfa/fxfa/fm2js/xfa_program.h" 12 LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)13extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 14 FX_SAFE_STRSIZE safe_size = size; 15 if (!safe_size.IsValid()) 16 return 0; 17 18 CFX_WideString input = 19 CFX_WideString::FromUTF8(CFX_ByteStringC(data, safe_size.ValueOrDie())); 20 CXFA_FMProgram program(input.AsStringC()); 21 if (program.ParseProgram()) 22 return 0; 23 24 CFX_WideTextBuf js; 25 program.TranslateProgram(js); 26 return 0; 27 } 28