summaryrefslogtreecommitdiff
path: root/chromium/net/dns/dns_parse_domain_ascii_win_fuzzer.cc
blob: b6a10efd9d681c0f2724f5801650b2c47bc79466 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "net/dns/dns_config_service_win.h"

#include <stddef.h>
#include <stdint.h>

#include <string>

#include "base/strings/string_piece.h"
#include "base/strings/string_util.h"

extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
  if (size > 8 * 1024)
    return 0;

  base::WStringPiece widestr(reinterpret_cast<const wchar_t*>(data), size / 2);
  std::string result = net::internal::ParseDomainASCII(widestr);

  if (!result.empty())
    // Call base::ToLowerASCII to get some additional code coverage signal.
    result = base::ToLowerASCII(result);

  return 0;
}