Skip to content

Commit

Permalink
Added a check for unfortunate values of a MAG record in a GDS text
Browse files Browse the repository at this point in the history
record.  Failure to use the right 8-byte real format can produce
bizarre results where a label's bounding box ends up in some random
place and messes up an entire top level circuit's bounding box.
  • Loading branch information
RTimothyEdwards committed Sep 19, 2022
1 parent 7905e15 commit 82c79b3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.3.324
8.3.325
14 changes: 10 additions & 4 deletions calma/CalmaRdpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -809,10 +809,16 @@ calmaElementText()
if (nbytes > 0 && rtype == CALMA_MAG)
{
calmaReadR8(&dval);

/* Assume that MAG is the label size in microns */
/* "size" is the label size in 10 * (database units) */
size = (int)((dval * 1000 * cifCurReadStyle->crs_multiplier)
/* Sanity check on dval (must be nonzero positive) */
if ((dval <= 0) || (dval > 10000))
{
CalmaReadError("Invalid text magnification %lg.\n", dval);
/* Keep default size */
}
else
/* Assume that MAG is the label size in microns */
/* "size" is the label size in 10 * (database units) */
size = (int)((dval * 1000 * cifCurReadStyle->crs_multiplier)
/ cifCurReadStyle->crs_scaleFactor);
}
else
Expand Down

0 comments on commit 82c79b3

Please # to comment.