com php-src: Fixed NULL pointer dereference: Zend/zend_API. c

From: Date: Wed, 05 Mar 2014 09:29:29 +0000
Subject: com php-src: Fixed NULL pointer dereference: Zend/zend_API. c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-77749@lists.php.net to get a copy of this message
Commit: 36f01f158cdcd9b2740388e0675b69652e2c9e6c Author: Xinchen Hui <laruence@gmail.com> Wed, 5 Mar 2014 17:29:29 +0800 Parents: 2ee6bc1309d43539a90cabb9d82b3f7e2698a7f2 Branches: phpng Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=36f01f158cdcd9b2740388e0675b69652e2c9e6c Log: Fixed NULL pointer dereference Changed paths: M Zend/zend_API.c Diff: diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 7aacad1..098407d 100644 --- a/Zend/zend_API..c +++ b/Zend/zend_API.c @@ -3154,19 +3154,20 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint ch if (zend_hash_num_elements(Z_ARRVAL_P(callable)) == 2) { obj = zend_hash_index_find(Z_ARRVAL_P(callable), 0); - if (UNEXPECTED(Z_ISREF_P(obj))) { - obj = Z_REFVAL_P(obj); - } method = zend_hash_index_find(Z_ARRVAL_P(callable), 1); - if (UNEXPECTED(Z_ISREF_P(method))) { - method = Z_REFVAL_P(method); - } } if (obj && method && (Z_TYPE_P(obj) == IS_OBJECT || Z_TYPE_P(obj) == IS_STRING) && Z_TYPE_P(method) == IS_STRING) { + if (UNEXPECTED(Z_ISREF_P(obj))) { + obj = Z_REFVAL_P(obj); + } + if (UNEXPECTED(Z_ISREF_P(method))) { + method = Z_REFVAL_P(method); + } + if (Z_TYPE_P(obj) == IS_STRING) { if (callable_name) { char *ptr; @@ -3233,7 +3234,9 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint ch } else { if (zend_hash_num_elements(Z_ARRVAL_P(callable)) == 2) { - if (!obj || (Z_TYPE_P(obj) != IS_STRING && Z_TYPE_P(obj) != IS_OBJECT)) { + if (!obj || (Z_ISREF_P(obj)? + (Z_TYPE_P(Z_REFVAL_P(obj)) != IS_STRING && Z_TYPE_P(Z_REFVAL_P(obj)) != IS_OBJECT) : + (Z_TYPE_P(obj) != IS_STRING && Z_TYPE_P(obj) != IS_OBJECT))) { if (error) zend_spprintf(error, 0, "first array member is not a valid class name or object"); } else { if (error) zend_spprintf(error, 0, "second array member is not a valid method");

« previous php.cvs (#77749) next »