Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 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/strings/utf_string_conversions.h> | |
| 9 #include "base/strings/string16.h" | |
| 10 | |
| 11 #include "components/policy/core/common/policy_load_status.h" | |
| 12 #include "components/policy/core/common/preg_parser.h" | |
| 13 #include "components/policy/core/common/registry_dict.h" | |
| 14 | |
| 15 namespace { | |
| 16 | |
| 17 const char kRegistryChromePolicyKey[] = "SOFTWARE\\Policies\\Chromium"; | |
| 18 | |
| 19 } // namespace | |
| 20 | |
| 21 namespace policy { | |
| 22 namespace preg_parser { | |
| 23 | |
| 24 // Disable logging. | |
| 25 struct Environment { | |
| 26 Environment() { logging::SetMinLogLevel(logging::LOG_FATAL); } | |
| 27 }; | |
| 28 | |
| 29 Environment* env = new Environment(); | |
| 30 | |
| 31 // Entry point for LibFuzzer. | |
| 32 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { | |
| 33 RegistryDict dict; | |
| 34 PolicyLoadStatus status; | |
| 35 const base::string16 root = base::ASCIIToUTF16(kRegistryChromePolicyKey); | |
|
Oliver Chang
2017/04/13 00:25:23
nit: it might be a little more efficient if base::
ljusten (tachyonic)
2017/04/13 11:17:15
I put it in env, but it's going to leak. Do you ge
Oliver Chang
2017/04/13 19:58:24
That's fine! It's only allocated once during fuzzi
| |
| 36 ReadDataInternal(data, size, root, &dict, &status, "data"); | |
| 37 return 0; | |
| 38 } | |
| 39 | |
| 40 } // namespace preg_parser | |
| 41 } // namespace policy | |
| OLD | NEW |