tony2001                Wed Oct 26 17:38:21 2005 EDT

  Modified files:              (Branch: PHP_5_1)
    /php-src    NEWS 
    /php-src/ext/gd     gd.c 
  Log:
  MFH: fix #34996 (ImageTrueColorToPalette() crashes when ncolors is zero)
  
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.2027.2.163&r2=1.2027.2.164&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.163 php-src/NEWS:1.2027.2.164
--- php-src/NEWS:1.2027.2.163   Wed Oct 26 09:50:39 2005
+++ php-src/NEWS        Wed Oct 26 17:38:19 2005
@@ -2,6 +2,8 @@
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? Oct 2005, PHP 5.1 Release Candidate 4
 - Fixed fgetcsv() and fputcsv() inconsistency. (Dmitry)
+- Fixed bug #34996 (ImageTrueColorToPalette() crashes when ncolors is 
+  zero). (Tony)
 - Fixed bug #34977 (Compile failure on MacOSX due to use of varargs.h). (Tony)
 - Fixed bug #34968 (bz2 extension fails on to build on some win32 setups).
   (Ilia)
http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.312.2.2&r2=1.312.2.3&ty=u
Index: php-src/ext/gd/gd.c
diff -u php-src/ext/gd/gd.c:1.312.2.2 php-src/ext/gd/gd.c:1.312.2.3
--- php-src/ext/gd/gd.c:1.312.2.2       Tue Oct 25 19:00:19 2005
+++ php-src/ext/gd/gd.c Wed Oct 26 17:38:20 2005
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: gd.c,v 1.312.2.2 2005/10/25 23:00:19 pajoye Exp $ */
+/* $Id: gd.c,v 1.312.2.3 2005/10/26 21:38:20 tony2001 Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
    Cold Spring Harbor Labs. */
@@ -890,6 +890,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