Corrected a potential segfaulting error in which (apparently)

port labels that are unnattached ("attached" to space), or possibly
sticky labels without any geometry underneath, end up with a NULL
node during EFBuild().
This commit is contained in:
Tim Edwards 2020-08-02 09:37:45 -04:00
parent e00a9a293f
commit 0598f4edf7
2 changed files with 22 additions and 14 deletions

View File

@ -1 +1 @@
8.3.45
8.3.46

View File

@ -155,23 +155,31 @@ efBuildNode(def, isSubsnode, nodeName, nodeCap, x, y, layerName, av, ac)
if (efWarn)
efReadError("Warning: duplicate node name %s\n", nodeName);
/* Just add to C, perim, area of existing node */
newnode = newname->efnn_node;
newnode->efnode_cap += (EFCapValue) nodeCap;
for (n = 0; n < efNumResistClasses && ac > 1; n++, ac -= 2)
/* newnode should exist if newname does. Having a NULL node */
/* may be caused by detached labels "connected" to space. */
if ((newnode = newname->efnn_node) != NULL)
{
newnode->efnode_pa[n].pa_area += atoi(*av++);
newnode->efnode_pa[n].pa_perim += atoi(*av++);
/* Just add to C, perim, area of existing node */
newnode->efnode_cap += (EFCapValue) nodeCap;
for (n = 0; n < efNumResistClasses && ac > 1; n++, ac -= 2)
{
newnode->efnode_pa[n].pa_area += atoi(*av++);
newnode->efnode_pa[n].pa_perim += atoi(*av++);
}
return;
}
return;
}
/* Allocate a new node with 'nodeName' as its single name */
newname = (EFNodeName *) mallocMagic((unsigned)(sizeof (EFNodeName)));
newname->efnn_hier = EFStrToHN((HierName *) NULL, nodeName);
newname->efnn_port = -1; /* No port assignment */
newname->efnn_next = NULL;
HashSetValue(he, (char *) newname);
if (!newname)
{
/* Allocate a new node with 'nodeName' as its single name */
newname = (EFNodeName *) mallocMagic((unsigned)(sizeof (EFNodeName)));
newname->efnn_hier = EFStrToHN((HierName *) NULL, nodeName);
newname->efnn_port = -1; /* No port assignment */
newname->efnn_next = NULL;
HashSetValue(he, (char *) newname);
}
/* New node itself */
size = sizeof (EFNode) + (efNumResistClasses - 1) * sizeof (EFPerimArea);