tony2001                Wed Oct 26 17:35:57 2005 EDT

  Modified files:              
    /php-src/ext/gd     gd.c 
  Log:
  fix #34996 (ImageTrueColorToPalette() crashes when ncolors is zero)
  
  
http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.316&r2=1.317&ty=u
Index: php-src/ext/gd/gd.c
diff -u php-src/ext/gd/gd.c:1.316 php-src/ext/gd/gd.c:1.317
--- php-src/ext/gd/gd.c:1.316   Sat Oct  8 15:29:04 2005
+++ php-src/ext/gd/gd.c Wed Oct 26 17:35:56 2005
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: gd.c,v 1.316 2005/10/08 19:29:04 pajoye Exp $ */
+/* $Id: gd.c,v 1.317 2005/10/26 21:35:56 tony2001 Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
    Cold Spring Harbor Labs. */
@@ -876,6 +876,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