prevent crash if mos instance has too few nodes - bug #391

This commit is contained in:
dwarning 2019-01-30 15:44:36 +01:00
parent 1c0890794b
commit 6a14271894
1 changed files with 7 additions and 3 deletions

View File

@ -94,8 +94,12 @@ INP2M(CKTcircuit *ckt, INPtables *tab, struct card *current)
INPtermInsert(ckt, &token, tab, &node[i]);
}
int model_numnodes_ = model_numnodes(thismodel->INPmodType);
if (i > model_numnodes_) {
if ((thismodel->INPmodType != INPtypelook("VDMOS")) && (i < 4)) {
LITERR ("too few nodes connected to instance");
return;
}
int model_max_numnodes = model_numnodes(thismodel->INPmodType);
if (i > model_max_numnodes) {
LITERR ("too many nodes connected to instance");
return;
}
@ -144,7 +148,7 @@ INP2M(CKTcircuit *ckt, INPtables *tab, struct card *current)
IFC (newInstance, (ckt, mdfast, &fast, name));
for (i = 0; i < model_numnodes_; i++)
for (i = 0; i < model_max_numnodes; i++)
if (i < numnodes)
IFC (bindNode, (ckt, fast, i + 1, node[i]));
else