Corrected a problem with an uninitialized entry in ExtCurStyle that

could cause serious errors on systems that do not auto-zero allocated
memory.  Also:  Fixed an error introduced by a recent commit to allocate
character memory for efReadLine() which frees the memory before reading
a .res.ext file, causing a crash when using "ext2spice" with the
"extresist on" option.
This commit is contained in:
Tim Edwards 2020-06-05 12:46:46 -04:00
parent ac244109bc
commit fc9ecd2c9b
7 changed files with 29 additions and 16 deletions

View File

@ -1 +1 @@
8.3.21 8.3.22

View File

@ -1784,8 +1784,6 @@ findTile(tile, rtype)
* purposes. * purposes.
*/ */
#define FLATTERMSIZE 1024
void void
FlatCopyAllLabels(scx, mask, xMask, targetUse) FlatCopyAllLabels(scx, mask, xMask, targetUse)
SearchContext *scx; SearchContext *scx;

View File

@ -661,9 +661,6 @@ dbcUnconnectFunc(tile, clientData)
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
/* To do: Make the tpath entries dynamically allocated */
#define FLATTERMSIZE 1024
int int
dbcConnectLabelFunc(scx, lab, tpath, csa2) dbcConnectLabelFunc(scx, lab, tpath, csa2)
SearchContext *scx; SearchContext *scx;
@ -690,12 +687,16 @@ dbcConnectLabelFunc(scx, lab, tpath, csa2)
if (scx->scx_use != csa2->csa2_topscx->scx_use) if (scx->scx_use != csa2->csa2_topscx->scx_use)
{ {
int newllen = tpath->tp_next - tpath->tp_first; if (tpath)
newlabtext[0] = '\0'; {
if (newllen > 0) int newllen = tpath->tp_next - tpath->tp_first;
strncpy(newlabtext, tpath->tp_first, newllen); newlabtext[0] = '\0';
sprintf(newlabtext + newllen, "%s", lab->lab_text); if (newllen > 0)
newlabptr = newlabtext; strncpy(newlabtext, tpath->tp_first, newllen);
sprintf(newlabtext + newllen, "%s", lab->lab_text);
newlabptr = newlabtext;
}
else return 0;
} }
else else
newlabptr = lab->lab_text; newlabptr = lab->lab_text;

View File

@ -651,6 +651,9 @@ typedef struct treeFilter
#define TF_LABEL_ATTACH_NOT_SW 0x20 /* Same as above, ignore tile SW corner */ #define TF_LABEL_ATTACH_NOT_SW 0x20 /* Same as above, ignore tile SW corner */
#define TF_LABEL_ATTACH_CORNER 0x3C /* Mask of the four types above */ #define TF_LABEL_ATTACH_CORNER 0x3C /* Mask of the four types above */
/* To do: Make the tpath entries dynamically allocated */
#define FLATTERMSIZE 1024 /* Used for generating flattened labels */
/* -------------- Undo information passed to DBPaintPlane ------------- */ /* -------------- Undo information passed to DBPaintPlane ------------- */
typedef struct typedef struct

View File

@ -606,7 +606,6 @@ resistChanged:
} }
} }
(void) fclose(inf); (void) fclose(inf);
if (line != NULL) freeMagic(line);
/* Is there an "extresist" extract file? */ /* Is there an "extresist" extract file? */
if (DoResist) if (DoResist)
@ -616,6 +615,7 @@ resistChanged:
if (inf != NULL) if (inf != NULL)
goto readfile; goto readfile;
} }
if (line != NULL) freeMagic(line);
/* If we are considering standard cells, only the first level of */ /* If we are considering standard cells, only the first level of */
/* subcircuits is meaningful. */ /* subcircuits is meaningful. */

View File

@ -810,8 +810,14 @@ ExtStyle *
extTechStyleNew() extTechStyleNew()
{ {
ExtStyle *style; ExtStyle *style;
TileType r;
style = extTechStyleAlloc(); style = extTechStyleAlloc();
/* This entry in ExtStyle is allocated and must be initialized */
for (r = 0; r < NT; r++)
style->exts_device[r] = NULL;
extTechStyleInit(style); extTechStyleInit(style);
return style; return style;
} }

View File

@ -103,6 +103,8 @@ dbcConnectFuncDCS(tile, cx)
int pNum; int pNum;
CellDef *def; CellDef *def;
ExtDevice *devptr; ExtDevice *devptr;
TerminalPath tpath;
char pathstring[FLATTERMSIZE];
TiToRect(tile, &tileArea); TiToRect(tile, &tileArea);
srArea = &scx->scx_area; srArea = &scx->scx_area;
@ -113,8 +115,6 @@ dbcConnectFuncDCS(tile, cx)
(tileArea.r_ytop <= srArea->r_ybot+1))) (tileArea.r_ytop <= srArea->r_ybot+1)))
return 0; return 0;
t1 = TiGetType(tile); t1 = TiGetType(tile);
if TTMaskHasType(&DiffTypeBitMask,t1) if TTMaskHasType(&DiffTypeBitMask,t1)
{ {
@ -264,7 +264,12 @@ dbcConnectFuncDCS(tile, cx)
scx2 = *csa2->csa2_topscx; scx2 = *csa2->csa2_topscx;
scx2.scx_area = newarea; scx2.scx_area = newarea;
DBTreeSrLabels(&scx2, connectMask, csa2->csa2_xMask, NULL,
pathstring[0] = '\0';
tpath.tp_first = tpath.tp_next = pathstring;
tpath.tp_last = pathstring + FLATTERMSIZE;
DBTreeSrLabels(&scx2, connectMask, csa2->csa2_xMask, &tpath,
TF_LABEL_ATTACH, dbcConnectLabelFunc, TF_LABEL_ATTACH, dbcConnectLabelFunc,
(ClientData)csa2); (ClientData)csa2);
// DBCellCopyLabels(&scx2, connectMask, csa2->csa2_xMask, csa2->csa2_use, NULL); // DBCellCopyLabels(&scx2, connectMask, csa2->csa2_xMask, csa2->csa2_use, NULL);