cvs: php-src /ext/gd gd.c
| From: | Antony Dovgal | Date: | Wed, 26 Oct 2005 21:35:57 +0000 |
| Subject: | cvs: php-src /ext/gd gd.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-34810@lists.php.net to get a copy of this message | ||
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;