tony2001                Thu Oct 27 06:29:34 2005 EDT

  Modified files:              (Branch: PHP_4_4)
    /php-src/ext/gd     gd.c 
  Log:
  MFH: fix #34996 (ImageTrueColorToPalette() crashes when ncolors is zero)
  
  
http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.221.2.56.2.1&r2=1.221.2.56.2.2&ty=u
Index: php-src/ext/gd/gd.c
diff -u php-src/ext/gd/gd.c:1.221.2.56.2.1 php-src/ext/gd/gd.c:1.221.2.56.2.2
--- php-src/ext/gd/gd.c:1.221.2.56.2.1  Thu Oct  6 16:44:52 2005
+++ php-src/ext/gd/gd.c Thu Oct 27 06:29:31 2005
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: gd.c,v 1.221.2.56.2.1 2005/10/06 20:44:52 iliaa Exp $ */
+/* $Id: gd.c,v 1.221.2.56.2.2 2005/10/27 10:29:31 tony2001 Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, 
    Cold Spring Harbor Labs. */
@@ -807,6 +807,10 @@
        convert_to_boolean_ex(dither);
        convert_to_long_ex(ncolors);
 
+       if (Z_LVAL_PP(ncolors) <= 0) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of colors 
has to be greater than zero");
+               RETURN_FALSE;
+       }
        gdImageTrueColorToPalette(im, Z_LVAL_PP(dither), Z_LVAL_PP(ncolors));
 
        RETURN_TRUE;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to