OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
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 "base/at_exit.h" | |
9 #include "base/i18n/icu_util.h" | |
10 #include "base/strings/string_piece.h" | |
11 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | |
12 #include "url/gurl.h" | |
13 | |
14 // Initialize ICU. | |
15 struct InitICU { | |
16 InitICU() { CHECK(base::i18n::InitializeICU()); } | |
17 base::AtExitManager at_exit_manager; | |
18 }; | |
19 | |
20 InitICU* init_icu = new InitICU(); | |
21 | |
22 // Entry point for LibFuzzer. | |
23 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { | |
24 net::registry_controlled_domains::PrivateRegistryFilter filter = | |
25 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES; | |
26 | |
27 // Use the input to vary the |filter| parameter. | |
28 if (size > 1) { | |
29 if ((data[0] ^ data[size - 1]) & 1) | |
mmenke
2016/03/02 16:51:44
So if size is 1, this is always false? Maybe add
eroman
2016/03/02 18:28:43
Done, made two calls.
| |
30 filter = net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES; | |
31 } | |
32 | |
33 net::registry_controlled_domains::GetDomainAndRegistry( | |
34 base::StringPiece(reinterpret_cast<const char*>(data), size), filter); | |
35 | |
36 return 0; | |
37 } | |
OLD | NEW |