cvs: gd /libgd gd.c

[email protected] ("Pierre-Alain Joye") Tue, 19 Jun 2007 20:25:32 -0000
Newsgroups php.gd.cvs
Message-ID <cvspajoye1182284732@cvsserver>
pajoye		Tue Jun 19 20:25:32 2007 UTC

  Modified files:              
    /gd/libgd	gd.c 
  Log:
  - #94, gdImageCreateXbm can crash if gdImageCreate fails
  
  
http://cvs.php.net/viewvc.cgi/gd/libgd/gd.c?r1=1.62&r2=1.63&diff_format=u
Index: gd/libgd/gd.c
diff -u gd/libgd/gd.c:1.62 gd/libgd/gd.c:1.63
--- gd/libgd/gd.c:1.62	Sun Jun 17 22:11:20 2007
+++ gd/libgd/gd.c	Tue Jun 19 20:25:32 2007
@@ -1,4 +1,4 @@
-/* $Id: gd.c,v 1.62 2007/06/17 22:11:20 nlopess Exp $ */
+/* $Id: gd.c,v 1.63 2007/06/19 20:25:32 pajoye Exp $ */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -2838,6 +2838,10 @@
     }
   bytes = (w * h / 8) + 1;
   im = gdImageCreate (w, h);
+  if (!im) {
+    return 0;
+  }
+
   gdImageColorAllocate (im, 255, 255, 255);
   gdImageColorAllocate (im, 0, 0, 0);
   x = 0;