$NetBSD$

--- gdk_imlib/io-tiff.c.orig	2002-03-04 18:06:29.000000000 +0100
+++ gdk_imlib/io-tiff.c	2004-12-10 10:00:56.000000000 +0100
@@ -36,7 +36,9 @@
   npix = ww * hh;
   *w = (int)ww;
   *h = (int)hh;
-  if(ww > 32767 || hh > 32767)
+  if (ww <= 0 || ww > 32767 ||
+      hh <= 0 || hh > 32767 ||
+      hh >= (G_MAXINT/sizeof(uint32)) / ww)
     {
       TIFFClose(tif);
       return NULL;
