1 // Copyright 2018 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 <string> 6 7 #include "core/fxcrt/widestring.h" 8 #include "fxjs/fx_date_helpers.h" 9 LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)10extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 11 auto* short_data = reinterpret_cast<const unsigned short*>(data); 12 size_t short_size = size / sizeof(unsigned short); 13 if (short_size > 2 && short_size < 8192) { 14 double ignore; 15 size_t short_len1 = short_size / 2; 16 size_t short_len2 = short_size - short_len1; 17 WideString input1 = WideString::FromUTF16LE(short_data, short_len1); 18 WideString input2 = 19 WideString::FromUTF16LE(short_data + short_len1, short_len2); 20 FX_ParseDateUsingFormat(input1, input2, &ignore); 21 } 22 return 0; 23 } 24