pajoye Tue Jan 17 16:34:58 2006 UTC Modified files: /php-src/ext/gd gd.c Log: - MFB: imagecolorallocate* returns false on error http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/gd.c?r1=1.338&r2=1.339&diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.338 php-src/ext/gd/gd.c:1.339 --- php-src/ext/gd/gd.c:1.338 Sun Jan 1 13:09:50 2006 +++ php-src/ext/gd/gd.c Tue Jan 17 16:34:58 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: gd.c,v 1.338 2006/01/01 13:09:50 sniper Exp $ */ +/* $Id: gd.c,v 1.339 2006/01/17 16:34:58 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -963,14 +963,18 @@ zval *IM; long red, green, blue, alpha; gdImagePtr im; + int ct = (-1); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zllll", &IM, &red, &green, &blue, &alpha) == FAILURE) { RETURN_FALSE; } ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd); - - RETURN_LONG(gdImageColorAllocateAlpha(im, red, green, blue, alpha)); + ct = gdImageColorAllocateAlpha(im, red, green, blue, alpha); + if (ct < 0) { + RETURN_FALSE; + } + RETURN_LONG(ct); } /* }}} */ @@ -1752,6 +1756,7 @@ { zval **IM, **red, **green, **blue; gdImagePtr im; + int ct = (-1); if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &red, &green, &blue) == FAILURE) { ZEND_WRONG_PARAM_COUNT(); @@ -1762,8 +1767,12 @@ convert_to_long_ex(red); convert_to_long_ex(green); convert_to_long_ex(blue); + ct = gdImageColorAllocate(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue)); + if (ct < 0) { + RETURN_FALSE; + } - RETURN_LONG(gdImageColorAllocate(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue))); + RETURN_LONG(ct); } /* }}} */
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php