2023-12-31 16:51:50 +01:00
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include <hyprlang.hpp>
|
|
|
|
|
|
|
|
#define FUZZ_ITERS 1337
|
|
|
|
|
|
|
|
std::string garbage() {
|
|
|
|
srand(time(nullptr));
|
|
|
|
|
|
|
|
int len = rand() % 10000;
|
|
|
|
|
|
|
|
std::string chars;
|
|
|
|
for (int i = 0; i < len; ++i) {
|
|
|
|
chars += rand() % 254 + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return chars;
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char** argv, char** envp) {
|
|
|
|
|
|
|
|
Hyprlang::CConfig config("./eeeeeeeUnused", {.allowMissingConfig = true});
|
2024-02-12 19:03:04 +01:00
|
|
|
config.addConfigValue("test", {(Hyprlang::INT)0});
|
2023-12-31 16:51:50 +01:00
|
|
|
|
|
|
|
config.parseDynamic("");
|
|
|
|
config.parseDynamic("", "");
|
|
|
|
config.parseDynamic("}");
|
|
|
|
for (size_t i = 0; i < FUZZ_ITERS; ++i) {
|
|
|
|
config.parseDynamic(garbage().c_str(), garbage().c_str());
|
|
|
|
config.parseDynamic((garbage() + "=" + garbage()).c_str());
|
|
|
|
config.parseDynamic(garbage().c_str());
|
|
|
|
config.parseDynamic((garbage() + " {").c_str());
|
|
|
|
config.parseDynamic((std::string{"test = "} + garbage()).c_str());
|
|
|
|
config.parseDynamic((std::string{"$"} + garbage()).c_str());
|
|
|
|
config.parseDynamic((std::string{"$VAR = "} + garbage()).c_str());
|
|
|
|
}
|
|
|
|
config.parseDynamic("}");
|
|
|
|
|
|
|
|
std::cout << "Success, no fuzzing errors\n";
|
|
|
|
|
|
|
|
return 0;
|
2024-02-12 19:03:04 +01:00
|
|
|
}
|