Found that ExtFindRegions() does not set temp_subsnode to NULL like

extFindNodes() does;  consequently, ExtLabelRegions() when called
after ExtFindRegions() may accidentally chain together a substrate
region with whatever was left in this linked list after the
previous call to extFindNodes(), with unpredictable results.
This commit is contained in:
Tim Edwards 2022-04-04 21:16:03 -04:00
parent a4c5945d60
commit 7199cefddc
2 changed files with 29 additions and 19 deletions

View File

@ -1 +1 @@
8.3.285 8.3.286

View File

@ -118,6 +118,9 @@ ExtFindRegions(def, area, mask, connectsTo, uninit, first, each)
arg.fra_each = each; arg.fra_each = each;
arg.fra_region = (Region *) NULL; arg.fra_region = (Region *) NULL;
/* Make sure temp_subsnode is NULL */
temp_subsnode = NULL;
SigDisableInterrupts(); SigDisableInterrupts();
for (arg.fra_pNum=PL_TECHDEPBASE; arg.fra_pNum<DBNumPlanes; arg.fra_pNum++) for (arg.fra_pNum=PL_TECHDEPBASE; arg.fra_pNum<DBNumPlanes; arg.fra_pNum++)
(void) DBSrPaintClient((Tile *) NULL, def->cd_planes[arg.fra_pNum], (void) DBSrPaintClient((Tile *) NULL, def->cd_planes[arg.fra_pNum],
@ -207,7 +210,8 @@ ExtLabelRegions(def, connTo, nodeList, clipArea)
Label *lab; Label *lab;
Tile *tp; Tile *tp;
LabRegion *reg; LabRegion *reg;
int quad, pNum; NodeRegion *newNode;
int quad, pNum, n, nclasses;
Point p; Point p;
bool found; bool found;
TileType extSubType = 0; TileType extSubType = 0;
@ -265,11 +269,29 @@ ExtLabelRegions(def, connTo, nodeList, clipArea)
/* substrate region. The label need not be in the */ /* substrate region. The label need not be in the */
/* clip area. */ /* clip area. */
ll = (LabelList *)NULL;
if ((pNum == ExtCurStyle->exts_globSubstratePlane) && if ((pNum == ExtCurStyle->exts_globSubstratePlane) &&
TTMaskHasType(&ExtCurStyle->exts_globSubstrateTypes, TTMaskHasType(&ExtCurStyle->exts_globSubstrateTypes,
lab->lab_type)) lab->lab_type))
{ {
if ((temp_subsnode != NULL) || (nodeList == NULL)) if (nodeList != NULL)
{
/* temp_subsnode only defined when extFindNodes() */
/* was called before ExtLabelRegions() */
if (temp_subsnode != NULL)
{
ll = (LabelList *)mallocMagic(sizeof(LabelList));
ll->ll_label = lab;
if (lab->lab_flags & PORT_DIR_MASK)
ll->ll_attr = LL_PORTATTR;
else
ll->ll_attr = LL_NOATTR;
ll->ll_next = temp_subsnode->nreg_labels;
temp_subsnode->nreg_labels = ll;
}
}
else
{ {
ll = (LabelList *)mallocMagic(sizeof(LabelList)); ll = (LabelList *)mallocMagic(sizeof(LabelList));
ll->ll_label = lab; ll->ll_label = lab;
@ -278,17 +300,9 @@ ExtLabelRegions(def, connTo, nodeList, clipArea)
else else
ll->ll_attr = LL_NOATTR; ll->ll_attr = LL_NOATTR;
if (nodeList != NULL) ll->ll_next = (LabelList *)NULL;
{ if (retList != NULL) freeMagic(retList);
ll->ll_next = temp_subsnode->nreg_labels; retList = ll;
temp_subsnode->nreg_labels = ll;
}
else
{
ll->ll_next = (LabelList *)NULL;
if (retList != NULL) freeMagic(retList);
retList = ll;
}
} }
} }
@ -296,15 +310,11 @@ ExtLabelRegions(def, connTo, nodeList, clipArea)
* TT_SPACE, then create a new node region for it. The * TT_SPACE, then create a new node region for it. The
* label must be within the clip area. * label must be within the clip area.
*/ */
else if ((nodeList != NULL) && if ((ll == NULL) && (nodeList != NULL) &&
(GEO_SURROUND(&lab->lab_rect, clipArea) || (GEO_SURROUND(&lab->lab_rect, clipArea) ||
GEO_TOUCH(&lab->lab_rect, clipArea)) GEO_TOUCH(&lab->lab_rect, clipArea))
&& (lab->lab_type != TT_SPACE)) && (lab->lab_type != TT_SPACE))
{ {
NodeRegion *newNode;
int n;
int nclasses;
nclasses = ExtCurStyle->exts_numResistClasses; nclasses = ExtCurStyle->exts_numResistClasses;
n = sizeof (NodeRegion) + (sizeof (PerimArea) * (nclasses - 1)); n = sizeof (NodeRegion) + (sizeof (PerimArea) * (nclasses - 1));
newNode = (NodeRegion *)mallocMagic((unsigned) n); newNode = (NodeRegion *)mallocMagic((unsigned) n);