1 // Copyright 2016 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/css/cfx_css.h" 6 #include "core/fxcrt/css/cfx_csssyntaxparser.h" 7 #include "core/fxcrt/fx_string.h" 8 LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)9extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 10 WideString input = 11 WideString::FromUTF8(ByteStringView(data, static_cast<size_t>(size))); 12 13 // If we convert the input into an empty string bail out. 14 if (input.IsEmpty()) 15 return 0; 16 17 CFX_CSSSyntaxParser parser(input.AsStringView()); 18 CFX_CSSSyntaxParser::Status status; 19 do { 20 status = parser.DoSyntaxParse(); 21 } while (status != CFX_CSSSyntaxParser::Status::kError && 22 status != CFX_CSSSyntaxParser::Status::kEOS); 23 return 0; 24 } 25