Modified the "box" command to run a check on the specified box values

and raise an error if the values are outside the range (MINFINITY,
INFINITY) used by magic's layout planes.
This commit is contained in:
Tim Edwards
2022-01-27 16:57:23 -05:00
parent 45bb62de2f
commit 62c8af719c
2 changed files with 15 additions and 2 deletions
+1 -1
View File
@@ -1 +1 @@
8.3.262
8.3.263
+14 -1
View File
@@ -615,7 +615,7 @@ CmdBox(w, cmd)
};
CellDef *rootBoxDef;
Rect rootBox, editbox, *boxptr;
Rect rootBox, editbox, savebox, *boxptr;
Point ll;
int option, direction, distancex, distancey;
int width, height;
@@ -756,6 +756,7 @@ CmdBox(w, cmd)
/*----------------------------------------------------------*/
boxptr = (refEdit) ? &editbox : &rootBox;
savebox = *boxptr;
/*----------------------------------------------------------*/
/* Parse arguments according to class */
@@ -1167,6 +1168,18 @@ badusage:
if (refEdit)
GeoTransRect(&EditToRootTransform, &editbox, &rootBox);
/*----------------------------------------------------------*/
/* Check for numerical overflow in box values */
/*----------------------------------------------------------*/
if (boxptr->r_ll.p_x < (MINFINITY + 2) || boxptr->r_ll.p_x > (INFINITY - 2) ||
boxptr->r_ll.p_y < (MINFINITY + 2) || boxptr->r_ll.p_y > (INFINITY - 2))
{
*boxptr = savebox;
TxError("Box out of bounds.\n");
return;
}
/*----------------------------------------------------------*/
/* Change the position of the box in the layout window */
/*----------------------------------------------------------*/