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 | |
please use gerrit instead
2016/06/03 17:52:45
No newline here.
mmoroz
2016/06/03 18:00:03
Done.
| |
11 #include "third_party/hunspell/fuzz/hunspell_fuzzer_dictionary.h" | |
12 | |
please use gerrit instead
2016/06/03 17:52:45
Only 1 newline here.
mmoroz
2016/06/03 18:00:03
Done.
| |
13 | |
14 // Entry point for LibFuzzer. | |
15 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { | |
16 if (!size) | |
17 return 0; | |
18 | |
19 static Hunspell* hunspell = new Hunspell( | |
20 reinterpret_cast<const unsigned char*>(kHunspellDictionary), | |
21 sizeof(kHunspellDictionary)); | |
22 | |
23 std::string data_string(reinterpret_cast<const char*>(data), size); | |
24 hunspell->spell(data_string.c_str()); | |
25 | |
26 char** suggestions = nullptr; | |
27 int suggetion_length = hunspell->suggest(&suggestions, data_string.c_str()); | |
28 hunspell->free_list(&suggestions, suggetion_length); | |
29 | |
30 return 0; | |
31 } | |
OLD | NEW |