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/cfx_widetextbuf.h" 9 #include "core/fxcrt/fx_safe_types.h" 10 #include "core/fxcrt/fx_string.h" 11 #include "fxjs/cfxjse_formcalc_context.h" 12 13 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 14 FX_SAFE_SIZE_T safe_size = size; 15 if (!safe_size.IsValid()) 16 return 0; 17 18 CFX_WideTextBuf js; 19 WideString input = 20 WideString::FromUTF8(ByteStringView(data, safe_size.ValueOrDie())); 21 CFXJSE_FormCalcContext::Translate(input.AsStringView(), &js); 22 return 0; 23 } 24