• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include <stddef.h>
6 #include <stdint.h>
7 
8 #include <string>
9 
10 #include "net/dns/dns_hosts.h"
11 
12 // Entry point for LibFuzzer.
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)13 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
14   std::string input(reinterpret_cast<const char*>(data), size);
15   net::DnsHosts dns_hosts;
16   net::ParseHostsWithCommaModeForTesting(input, &dns_hosts,
17                                          net::PARSE_HOSTS_COMMA_IS_TOKEN);
18   dns_hosts.clear();
19   net::ParseHostsWithCommaModeForTesting(input, &dns_hosts,
20                                          net::PARSE_HOSTS_COMMA_IS_WHITESPACE);
21   return 0;
22 }
23