6ccfd1
--- libwmf-0.2.8.4/src/extra/gd/gd_gd.c	2010-12-06 14:56:06.000000000 +0000
6ccfd1
+++ libwmf-0.2.8.4/src/extra/gd/gd_gd.c	2010-12-06 14:57:04.000000000 +0000
6ccfd1
@@ -42,6 +42,10 @@
6ccfd1
 	    {
6ccfd1
 	      goto fail1;
6ccfd1
 	    }
6ccfd1
+	  if (&im->colorsTotal > gdMaxColors)
6ccfd1
+	    {
6ccfd1
+	      goto fail1;
6ccfd1
+	    }
6ccfd1
 	}
6ccfd1
       /* Int to accommodate truecolor single-color transparency */
6ccfd1
       if (!gdGetInt (&im->transparent, in))