Check the range of the CLI-specified palette size

This commit is contained in:
ISSOtm
2022-03-13 11:02:31 +01:00
committed by Eldred Habert
parent b0f8e04fb7
commit e86eb9337a

View File

@@ -350,6 +350,11 @@ int main(int argc, char *argv[]) {
if (*arg != '\0') {
error("Palette size (-s) argument must be a valid number, not \"%s\"", musl_optarg);
}
if (options.nbColorsPerPal > 4) {
error("Palette size (-s) argument must not exceed 4!");
} else if (options.nbColorsPerPal == 0) {
error("Palette size (-s) argument may not be 0!");
}
break;
case 'T':
autoTilemap = true;