mirror of
https://github.com/hyprwm/hyprlang.git
synced 2024-12-23 02:19:50 +01:00
573cf83c51
* Fix compilation on 32-bit architectures The 1234L suffix creates a 'long', which is not 64-bit on 32-bit architectures. * Use stoll instead of stol to fix colors on 32-bit systems on 32 bit systems, 'long' is 32 bits and 'long long' is 64 bits, so the 'long long' functions need to be used. * Fix rgba and rgb values on 32-bit * Use a cast to Hyprlang::INT
42 lines
1.1 KiB
C++
42 lines
1.1 KiB
C++
#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});
|
|
config.addConfigValue("test", {(Hyprlang::INT)0});
|
|
|
|
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;
|
|
}
|