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