Last active
March 28, 2019 21:05
-
-
Save drewxa/2b36b505a3b3f5076d601aeb51903637 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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