Skip to content

Instantly share code, notes, and snippets.

@drewxa
Last active March 28, 2019 21:05
Show Gist options
  • Save drewxa/2b36b505a3b3f5076d601aeb51903637 to your computer and use it in GitHub Desktop.
Save drewxa/2b36b505a3b3f5076d601aeb51903637 to your computer and use it in GitHub Desktop.
bool TargetFunction(const nlohman::json& json, Results& out) {
if (json["key1"] != "static string")
return false;
if (json["search_type"] == "QUEUE") {
// основная логика функции, дальнейший парсинг json
} else if (json["search_type"] == "STACK") {
// основная логика функции, дальнейший парсинг json
} else {
// основная логика функции, дальнейший парсинг json
}
}
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
std::string json_data(reinterpret_cast<const char*>(data), size);
nlohman::json value(json_data);
Results results;
TargetFunction(value, results);
}
{
"key1": "static string",
"key2": "input",
"array": [
"abracatabra", "blablabla", "yahooooooo!"
],
"search_type": "QUEUE"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment