Prevent crash when number of parameter dependencies increases beyond

limit. Raise the limit from 100 to 200.
This commit is contained in:
Holger Vogt 2023-07-25 15:18:02 +02:00
parent 18911b06b6
commit 3adfa89cfc
1 changed files with 8 additions and 1 deletions

View File

@ -66,6 +66,8 @@ Author: 1985 Wayne A. Christopher
#define NPARAMS 10000
#define FCN_PARAMS 1000
#define DEPENDSON 200
#define VALIDCHARS "!$%_#?@.[]&"
static struct library {
@ -4745,7 +4747,7 @@ struct dependency {
int skip;
char *param_name;
char *param_str;
char *depends_on[100];
char *depends_on[DEPENDSON];
struct card *card;
};
@ -5055,6 +5057,11 @@ static void inp_sort_params(struct card *param_cards,
for (ind = 0; deps[j].depends_on[ind]; ind++)
;
deps[j].depends_on[ind++] = param;
if (ind == DEPENDSON) {
fprintf(stderr, "Error in netlist: Too many parameter dependencies (> %d)\n", ind);
fprintf(stderr, " Please check your netlist.\n");
controlled_exit(EXIT_BAD);
}
deps[j].depends_on[ind] = NULL;
}
}