1 // Copyright 2016 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/dns/dns_hosts.h" 16 17 // Entry point for LibFuzzer. LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)18extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 19 std::string input(reinterpret_cast<const char*>(data), size); 20 net::DnsHosts dns_hosts; 21 net::ParseHostsWithCommaModeForTesting(input, &dns_hosts, 22 net::PARSE_HOSTS_COMMA_IS_TOKEN); 23 dns_hosts.clear(); 24 net::ParseHostsWithCommaModeForTesting(input, &dns_hosts, 25 net::PARSE_HOSTS_COMMA_IS_WHITESPACE); 26 return 0; 27 } 28