71ed48
--- gd-2.0.28/gd_gd.c	2004-05-24 17:28:12.000000000 +0200
71ed48
+++ gd-2.0.28_new/gd_gd.c	2009-12-08 15:19:16.159836680 +0100
71ed48
@@ -44,6 +44,9 @@
71ed48
 	    {
71ed48
 	      goto fail1;
71ed48
 	    }
71ed48
+	    if (im->colorsTotal > gdMaxColors) {
71ed48
+	      goto fail1;
71ed48
+		}
71ed48
 	}
71ed48
       /* Int to accommodate truecolor single-color transparency */
71ed48
       if (!gdGetInt (&im->transparent, in))