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 // Call GetDomainAndRegistry() twice - once with each filter type to ensure |
| 25 // both code paths are exercised. |
| 26 net::registry_controlled_domains::GetDomainAndRegistry( |
| 27 base::StringPiece(reinterpret_cast<const char*>(data), size), |
| 28 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); |
| 29 |
| 30 net::registry_controlled_domains::GetDomainAndRegistry( |
| 31 base::StringPiece(reinterpret_cast<const char*>(data), size), |
| 32 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); |
| 33 |
| 34 return 0; |
| 35 } |
OLD | NEW |