| 12 | #include <string> |
| 13 | |
| 14 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { |
| 15 | if(Size == 0) { |
| 16 | return 0; |
| 17 | } |
| 18 | std::string parseString(reinterpret_cast<const char *>(Data), Size); |
| 19 | std::stringstream out(parseString); |
| 20 | CLI::FuzzApp fuzzdata; |
| 21 | |
| 22 | auto app = fuzzdata.generateApp(); |
| 23 | try { |
| 24 | app->parse_from_stream(out); |
| 25 | // should be able to write the config to a file and read from it again |
| 26 | std::string configOut = app->config_to_str(); |
| 27 | |
| 28 | app->clear(); |
| 29 | std::stringstream out(configOut); |
| 30 | app->parse_from_stream(out); |
| 31 | } catch(const CLI::HorribleError &he) { |
| 32 | throw; |
| 33 | } catch(const CLI::ParseError &e) { |
| 34 | // (app)->exit(e); |
| 35 | // this just indicates we caught an error known by CLI |
| 36 | } |
| 37 | |
| 38 | return 0; // Non-zero return values are reserved for future use. |
| 39 | } |
nothing calls this directly
no test coverage detected