mirror of
https://github.com/RTimothyEdwards/magic.git
synced 2026-10-06 09:53:00 +02:00
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:
+14
-1
@@ -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 */
|
||||
/*----------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user