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 #ifdef UNSAFE_BUFFERS_BUILD 6 // TODO(crbug.com/40284755): Remove this and spanify to fix the errors. 7 #pragma allow_unsafe_buffers 8 #endif 9 10 #include <stddef.h> 11 #include <stdint.h> 12 13 #include <string> 14 15 #include "net/base/url_util.h" 16 #include "third_party/icu/fuzzers/fuzzer_utils.h" 17 #include "url/url_canon.h" 18 19 struct Environment { 20 IcuEnvironment icu_environment; 21 }; 22 LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)23extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 24 static Environment env; 25 26 if (size < 1) { 27 return 0; 28 } 29 30 std::string_view host(reinterpret_cast<const char*>(data), size); 31 url::CanonHostInfo host_info; 32 net::CanonicalizeHost(host, &host_info); 33 return 0; 34 } 35