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 "net/base/url_util.h" 11 #include "third_party/icu/fuzzers/fuzzer_utils.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::string_view host(reinterpret_cast<const char*>(data), size); 26 url::CanonHostInfo host_info; 27 net::CanonicalizeHost(host, &host_info); 28 return 0; 29 } 30