$NetBSD: patch-aa,v 1.8 2002/09/12 18:50:29 tron Exp $

--- scan.c.orig	Sun Nov  7 07:51:55 1999
+++ scan.c	Thu Sep 12 20:48:45 2002
@@ -43,6 +43,8 @@
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include <limits.h>
+
 #include "xearth.h"
 #include "kljcpyrt.h"
 
@@ -626,6 +628,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 +1001,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);
