Added a check for unfortunate values of a MAG record in a GDS text
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.
This commit is contained in:
parent
7905e15ae3
commit
82c79b36ee
|
|
@ -809,10 +809,16 @@ calmaElementText()
|
||||||
if (nbytes > 0 && rtype == CALMA_MAG)
|
if (nbytes > 0 && rtype == CALMA_MAG)
|
||||||
{
|
{
|
||||||
calmaReadR8(&dval);
|
calmaReadR8(&dval);
|
||||||
|
/* Sanity check on dval (must be nonzero positive) */
|
||||||
/* Assume that MAG is the label size in microns */
|
if ((dval <= 0) || (dval > 10000))
|
||||||
/* "size" is the label size in 10 * (database units) */
|
{
|
||||||
size = (int)((dval * 1000 * cifCurReadStyle->crs_multiplier)
|
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);
|
/ cifCurReadStyle->crs_scaleFactor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue