Re: com php-src: Fixed Magic getter bug tickled by Moodle: Zend/zend_object_handlers.c
| From: | Nikita Popov | Date: | Sat, 31 Jan 2015 10:23:06 +0000 |
| Subject: | Re: com php-src: Fixed Magic getter bug tickled by Moodle: Zend/zend_object_handlers.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-84490@lists.php.net to get a copy of this message | ||
On Sat, Jan 31, 2015 at 11:12 AM, Xinchen Hui <laruence@php.net> wrote:
> Commit: 1a60175e2595a24ebc3b6d80a112d574c6c98f58
> Author: Xinchen Hui <laruence@php.net> Sat, 31 Jan 2015
> 18:12:31 +0800
> Parents: 8aab1c619c66f1b8eba8484501a26aadcee64677
> Branches: master
>
> Link:
>
> http://git.php.net/?p=php-src.git;a=commitdiff;h=1a60175e2595a24ebc3b6d80a112d574c6c98f58
>
> Log:
> Fixed Magic getter bug tickled by Moodle
>
> Changed paths:
> M Zend/zend_object_handlers.c
>
>
> Diff:
> diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
> index c77754f..f316bc8 100644
> --- a/Zend/zend_object_handlers.c
> +++ b/Zend/zend_object_handlers.c
> @@ -475,20 +475,24 @@ ZEND_API int zend_check_property_access(zend_object
> *zobj, zend_string *prop_inf
> }
> /* }}} */
>
> +static void zend_property_guard_dtor(zval *el) /* {{{ */ {
> + efree(Z_PTR_P(el));
> +}
> +/* }}} */
> +
> static zend_long *zend_get_property_guard(zend_object *zobj, zend_string
> *member) /* {{{ */
> {
> - zval stub, *guard;
> + zend_long stub, *guard;
>
> if (!zobj->guards) {
> ALLOC_HASHTABLE(zobj->guards);
> - zend_hash_init(zobj->guards, 8, NULL, NULL, 0);
> - } else if ((guard = zend_hash_find(zobj->guards, member)) != NULL)
> {
> - return &Z_LVAL_P(guard);
> + zend_hash_init(zobj->guards, 8, NULL,
> zend_property_guard_dtor, 0);
> + } else if ((guard = (zend_long *)zend_hash_find_ptr(zobj->guards,
> member)) != NULL) {
> + return guard;
> }
>
> - ZVAL_LONG(&stub, 0);
> - guard = zend_hash_add_new(zobj->guards, member, &stub);
> - return &Z_LVAL_P(guard);
> + stub = 0;
> + return (zend_long *)zend_hash_add_mem(zobj->guards, member, &stub,
> sizeof(zend_ulong));
> }
> /* }}} */
>
What was the problem that caused this? An invalidated guard pointer due to
an HT resize?
Nikita