1 // Copyright 2024 The Chromium 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 <stddef.h> 6 #include <stdint.h> 7 8 #include <string> 9 10 #include "third_party/icu/fuzzers/fuzzer_utils.h" 11 #include "url/third_party/mozilla/url_parse.h" 12 #include "url/url_canon.h" 13 14 struct Environment { 15 IcuEnvironment icu_environment; 16 }; 17 LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)18extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 19 static Environment env; 20 21 if (size < 1) { 22 return 0; 23 } 24 25 std::u16string_view input(reinterpret_cast<const char16_t*>(data), 26 size / sizeof(const char16_t)); 27 url::RawCanonOutputW<1024> output; 28 29 url::IDNToASCII(input, &output); 30 return 0; 31 } 32