Added code to avoid mishandling negative layer numbers when a

label in a DEF file is on a layer that has not been properly
mapped to a magic layer.  This would apply a negative index to
a TileType bitmask and crash the program.  Also:  Changed the
style and colormap slightly to make the via2 and via4 styles
more visible.
This commit is contained in:
Tim Edwards 2019-02-14 12:19:50 -05:00
parent 4348c11f10
commit 5693729ad5
4 changed files with 50 additions and 6 deletions

View File

@ -686,7 +686,7 @@ DefReadPins(f, rootDef, sname, oscale, total)
{
char *token;
char pinname[LEF_LINE_MAX];
int keyword, subkey, values;
int keyword, subkey, values, flags;
int processed = 0;
int pinDir = PORT_CLASS_DEFAULT;
int pinNum = 0;
@ -805,10 +805,18 @@ DefReadPins(f, rootDef, sname, oscale, total)
currect = LefReadRect(f, curlayer, oscale);
if (pending)
{
flags = PORT_DIR_MASK;
/* If layer was unknown, set to space and force */
/* non-sticky. */
if (curlayer < 0)
curlayer = TT_SPACE;
else
flags |= LABEL_STICKY;
GeoTransRect(&t, currect, &topRect);
DBPaint(rootDef, &topRect, curlayer);
DBPutLabel(rootDef, &topRect, -1, pinname, curlayer,
pinNum | pinDir | PORT_DIR_MASK | LABEL_STICKY);
pinNum | pinDir | flags);
pending = FALSE;
pinNum++;
}
@ -820,10 +828,18 @@ DefReadPins(f, rootDef, sname, oscale, total)
pending = TRUE;
else
{
flags = PORT_DIR_MASK;
/* If layer was unknown, set to space and force */
/* non-sticky. */
if (curlayer < 0)
curlayer = TT_SPACE;
else
flags |= LABEL_STICKY;
GeoTransRect(&t, currect, &topRect);
DBPaint(rootDef, &topRect, curlayer);
DBPutLabel(rootDef, &topRect, -1, pinname, curlayer,
pinNum | pinDir | PORT_DIR_MASK | LABEL_STICKY);
pinNum | pinDir | flags);
pinNum++;
}
break;

View File

@ -1748,6 +1748,7 @@ enum lef_layer_keys {LEF_LAYER_TYPE=0, LEF_LAYER_WIDTH,
LEF_LAYER_WIREEXT,
LEF_LAYER_RES, LEF_LAYER_CAP, LEF_LAYER_EDGECAP,
LEF_LAYER_THICKNESS, LEF_LAYER_HEIGHT,
LEF_LAYER_PROPERTY, LEF_LAYER_ACDENSITY, LEF_LAYER_DCDENSITY,
LEF_LAYER_MINDENSITY, LEF_LAYER_ANTENNADIFF,
LEF_LAYER_ANTENNAAREA, LEF_LAYER_ANTENNASIDE,
LEF_VIA_DEFAULT, LEF_VIA_LAYER, LEF_VIA_RECT,
@ -1794,6 +1795,9 @@ LefReadLayerSection(f, lname, mode, lefl)
"EDGECAPACITANCE",
"THICKNESS",
"HEIGHT",
"PROPERTY",
"ACCURRENTDENSITY",
"DCCURRENTDENSITY",
"MINIMUMDENSITY",
"ANTENNAAREARATIO",
"ANTENNADIFFAREARATIO",
@ -1872,6 +1876,30 @@ LefReadLayerSection(f, lname, mode, lefl)
lefl->info.route.spacing = (int)roundf(fvalue / oscale);
LefEndStatement(f);
break;
case LEF_LAYER_PROPERTY:
/* Ignoring property statements */
LefEndStatement(f);
break;
case LEF_LAYER_ACDENSITY:
/* Stupid syntax */
token = LefNextToken(f, TRUE); /* value type */
token = LefNextToken(f, TRUE); /* value, FREQUENCY */
if (!strcmp(token, "FREQUENCY")) {
LefEndStatement(f);
token = LefNextToken(f, TRUE);
if (!strcmp(token, "WIDTH")) /* Optional width */
LefEndStatement(f); /* Additional TABLEENTRIES */
}
LefEndStatement(f);
break;
case LEF_LAYER_DCDENSITY:
/* Stupid syntax */
token = LefNextToken(f, TRUE); /* value type */
token = LefNextToken(f, TRUE); /* value, WIDTH */
if (!strcmp(token, "WIDTH"))
LefEndStatement(f); /* Additional TABLEENTRIES */
LefEndStatement(f);
break;
case LEF_LAYER_SPACINGTABLE:
/* To do: Handle spacing tables */
LefEndStatement(f);

View File

@ -186,8 +186,8 @@ layout_styles
51 92 53 0x00 stipple 8 - metal3tight
91 63 53 0x00 stipple 1 - obsmetal3
37 92 46 0xff stipple 19 - via2
56 120 53 0xff stipple 36 - via2arrow
82 120 53 0xff stipple 2 - via2alt
56 120 46 0xff stipple 36 - via2arrow
82 120 46 0xff stipple 2 - via2alt
23 80 33 0x00 solid 0 - metal4
92 63 33 0x00 stipple 1 - obsmetal4
38 92 38 0xff stipple 24 - via3

View File

@ -23,7 +23,7 @@
210 0 155 38 dark_red
165 216 175 39 pale_green
124 191 148 40 medium_green
0 181 0 41 dark_green
0 141 0 41 dark_green
170 202 242 42 light_blue
100 150 250 43 bright_blue
40 169 166 44 teal_blue