sas Thu Apr 3 14:18:58 2003 EDT
Modified files:
/php4/ext/gd gd.c
Log:
Fix segfaults in imagecreate/imagecreatetruecolor
Index: php4/ext/gd/gd.c
diff -u php4/ext/gd/gd.c:1.261 php4/ext/gd/gd.c:1.262
--- php4/ext/gd/gd.c:1.261 Mon Mar 31 03:49:19 2003
+++ php4/ext/gd/gd.c Thu Apr 3 14:18:57 2003
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: gd.c,v 1.261 2003/03/31 08:49:19 sniper Exp $ */
+/* $Id: gd.c,v 1.262 2003/04/03 19:18:57 sas Exp $ */
/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
Cold Spring Harbor Labs. */
@@ -800,6 +800,12 @@
convert_to_long_ex(x_size);
convert_to_long_ex(y_size);
+ if (Z_LVAL_PP(x_size) <= 0
+ || Z_LVAL_PP(y_size) <= 0) {
+ php_error(E_WARNING, "invalid image dimensions");
+ RETURN_FALSE;
+ }
+
im = gdImageCreateTrueColor(Z_LVAL_PP(x_size), Z_LVAL_PP(y_size));
ZEND_REGISTER_RESOURCE(return_value, im, le_gd);
@@ -1242,6 +1248,12 @@
convert_to_long_ex(x_size);
convert_to_long_ex(y_size);
+
+ if (Z_LVAL_PP(x_size) <= 0
+ || Z_LVAL_PP(y_size) <= 0) {
+ php_error(E_WARNING, "invalid image dimensions");
+ RETURN_FALSE;
+ }
im = gdImageCreate(Z_LVAL_PP(x_size), Z_LVAL_PP(y_size));
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php