Added check for non-numeric characters in the arguments for the --resolution flag.

This commit is contained in:
Leon Styhre 2021-03-21 21:54:30 +01:00
parent ef7c83b7e5
commit 8bf304b867

View file

@ -182,6 +182,13 @@ bool parseArgs(int argc, char* argv[])
std::cerr << "Error: Invalid resolution values supplied.\n";
return false;
}
std::string widthArg = argv[i + 1];
std::string heightArg = argv[i + 2];
if (widthArg.find_first_not_of("0123456789") != std::string::npos ||
heightArg.find_first_not_of("0123456789") != std::string::npos) {
std::cerr << "Error: Invalid resolution values supplied.\n";
return false;
}
int width = atoi(argv[i + 1]);
int height = atoi(argv[i + 2]);
if (width < 640 || height < 480 || width > 7680 || height > 4320 ||