| #include <fuzzer/FuzzedDataProvider.h> |
| |
| #include <string> |
| |
| #include "security/laser/sundew/targetgen/fuzzer_util/fuzzer_temp_file.h" |
| #include "third_party/hunspell/src/hunspell/hunspell.hxx" |
| |
| extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { |
| if (size > 2<<13) { // Don't process gigantic inputs |
| return 0; |
| } |
| |
| FuzzedDataProvider fdp(data, size); |
| |
| std::string affix = fdp.ConsumeRandomLengthString(size); |
| FuzzerTemporaryFile affix_file( |
| reinterpret_cast<const uint8_t *>(affix.c_str()), affix.length()); |
| std::string dict = fdp.ConsumeRemainingBytesAsString(); |
| FuzzerTemporaryFile dict_file(reinterpret_cast<const uint8_t *>(dict.c_str()), |
| dict.length()); |
| |
| Hunspell* hs = new Hunspell(affix_file.filename(), dict_file.filename()); |
| delete hs; |
| |
| return 0; |
| } |