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