From afa77062d1efb94d2f9a1a7c29f1e55687511027 Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Tue, 17 Jan 2006 15:44:12 +0000 Subject: [PATCH] - return false on error --- ext/gd/gd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 9aa328c538..150a63afd8 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -1967,6 +1967,7 @@ PHP_FUNCTION(imagecolorallocate) { 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(); @@ -1977,8 +1978,11 @@ PHP_FUNCTION(imagecolorallocate) convert_to_long_ex(red); convert_to_long_ex(green); convert_to_long_ex(blue); - - RETURN_LONG(gdImageColorAllocate(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue))); + ct = gdImageColorAllocate(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue)); + if (ct < 0) { + RETURN_FALSE; + } + RETURN_LONG(ct); } /* }}} */ -- 2.50.1