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 #include <string> | |
8 | |
9 #include "third_party/hunspell/src/hunspell/hunspell.hxx" | |
10 | |
11 #include "third_party/hunspell/fuzz/hunspell_fuzzer_dictionary.h" | |
12 | |
13 static Hunspell* CreateHunspell() { | |
14 return new Hunspell( | |
15 reinterpret_cast<const unsigned char*>(kHunspellDictionary), | |
16 sizeof(kHunspellDictionary)); | |
please use gerrit instead
2016/06/02 16:03:50
When used with expressions (not types), the parens
mmoroz
2016/06/03 13:07:37
Yeah, but it is absolutely legit since "expression
| |
17 } | |
18 | |
19 // Entry point for LibFuzzer. | |
20 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { | |
21 if (!size) | |
22 return 0; | |
23 | |
24 static Hunspell* hunspell = CreateHunspell(); | |
25 std::string data_string(reinterpret_cast<const char*>(data), size); | |
26 hunspell->spell(data_string.c_str()); | |
27 | |
28 char** suggestions = nullptr; | |
29 int suggetion_length = hunspell->suggest(&suggestions, data_string.c_str()); | |
30 hunspell->free_list(&suggestions, suggetion_length); | |
31 | |
32 return 0; | |
33 } | |
OLD | NEW |