--- scan.c.orig	Sun Nov  7 01:51:55 1999
+++ scan.c	Tue Jul 10 09:31:14 2001
@@ -626,6 +626,10 @@
   right  = XPROJECT(M_PI);
   top    = YPROJECT(BigNumber);
   bottom = YPROJECT(-BigNumber);
+  if (top >= INT_MAX) top = INT_MAX - 1;
+  if (top <= INT_MIN) top = INT_MIN + 1;
+  if (bottom >= INT_MAX) bottom = INT_MAX - 1;
+  if (bottom <= INT_MIN) bottom = INT_MIN + 1;
 
   scan(right, top, left, top);
   scan(left, top, left, bottom);
@@ -995,6 +999,10 @@
   right  = XPROJECT(M_PI);
   top    = YPROJECT(BigNumber);
   bottom = YPROJECT(-BigNumber);
+  if (top >= INT_MAX) top = INT_MAX - 1;
+  if (top <= INT_MIN) top = INT_MIN + 1;
+  if (bottom >= INT_MAX) bottom = INT_MAX - 1;
+  if (bottom <= INT_MIN) bottom = INT_MIN + 1;
 
   scan(right, top, left, top);
   scan(left, top, left, bottom);
