• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2018 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 #include <string_view>
15 
16 #include "base/strings/string_util.h"
17 #include "net/dns/dns_config_service_win.h"
18 
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)19 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
20   if (size > 8 * 1024)
21     return 0;
22 
23   std::wstring_view widestr(reinterpret_cast<const wchar_t*>(data), size / 2);
24   std::string result = net::internal::ParseDomainASCII(widestr);
25 
26   if (!result.empty())
27     // Call base::ToLowerASCII to get some additional code coverage signal.
28     result = base::ToLowerASCII(result);
29 
30   return 0;
31 }
32