| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/at_exit.h" | |
| 9 #include "base/i18n/icu_util.h" | |
| 10 #include "base/strings/string_piece.h" | 8 #include "base/strings/string_piece.h" |
| 11 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 9 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 12 #include "url/gurl.h" | 10 #include "url/gurl.h" |
| 13 | 11 |
| 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. | 12 // Entry point for LibFuzzer. |
| 23 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { | 13 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
| 24 // Call GetDomainAndRegistry() twice - once with each filter type to ensure | 14 // Call GetDomainAndRegistry() twice - once with each filter type to ensure |
| 25 // both code paths are exercised. | 15 // both code paths are exercised. |
| 26 net::registry_controlled_domains::GetDomainAndRegistry( | 16 net::registry_controlled_domains::GetDomainAndRegistry( |
| 27 base::StringPiece(reinterpret_cast<const char*>(data), size), | 17 base::StringPiece(reinterpret_cast<const char*>(data), size), |
| 28 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); | 18 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); |
| 29 | 19 |
| 30 net::registry_controlled_domains::GetDomainAndRegistry( | 20 net::registry_controlled_domains::GetDomainAndRegistry( |
| 31 base::StringPiece(reinterpret_cast<const char*>(data), size), | 21 base::StringPiece(reinterpret_cast<const char*>(data), size), |
| 32 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); | 22 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); |
| 33 | 23 |
| 34 return 0; | 24 return 0; |
| 35 } | 25 } |
| OLD | NEW |