com php-src: Fixed the third one of (segfault in gc_remove_ from_buffer()): ext/reflection/php_reflection.c
| From: | Xinchen Hui | Date: | Sun, 04 Oct 2015 03:15:35 +0000 |
| Subject: | com php-src: Fixed the third one of (segfault in gc_remove_ from_buffer()): ext/reflection/php_reflection.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-89277@lists.php.net to get a copy of this message | ||
Commit: 6876112c89e6dc4434e64a78084ca3bb118c98bd
Author: Xinchen Hui <laruence@gmail.com> Sat, 3 Oct 2015 20:14:55 -0700
Parents: 4744eec753786e18b28887463bdcb3f1e91efb60
Branches: PHP-5.6 PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6876112c89e6dc4434e64a78084ca3bb118c98bd
Log:
Fixed the third one of (segfault in gc_remove_from_buffer())
This one maybe only used in debug mode, so no bug report and no test
script provided
Changed paths:
M ext/reflection/php_reflection.c
Diff:
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 3bf49ea...e1a2c57 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -750,14 +750,18 @@ static void _parameter_string(string *str, zend_function *fptr, struct
_zend_arg
zend_class_entry *old_scope;
string_write(str, " = ", sizeof(" = ")-1);
- ALLOC_ZVAL(zv);
- *zv = *precv->op2.zv;
- zval_copy_ctor(zv);
- INIT_PZVAL(zv);
- old_scope = EG(scope);
- EG(scope) = fptr->common.scope;
- zval_update_constant_ex(&zv, 1, NULL TSRMLS_CC);
- EG(scope) = old_scope;
+ if (IS_CONSTANT_TYPE(Z_TYPE_P(precv->op2.zv))) {
+ ALLOC_ZVAL(zv);
+ *zv = *precv->op2.zv;
+ zval_copy_ctor(zv);
+ INIT_PZVAL(zv);
+ old_scope = EG(scope);
+ EG(scope) = fptr->common.scope;
+ zval_update_constant_ex(&zv, 1, NULL TSRMLS_CC);
+ EG(scope) = old_scope;
+ } else {
+ zv = precv->op2.zv;
+ }
if (Z_TYPE_P(zv) == IS_BOOL) {
if (Z_LVAL_P(zv)) {
string_write(str, "true", sizeof("true")-1);
@@ -782,7 +786,9 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg
zval_dtor(&zv_copy);
}
}
- zval_ptr_dtor(&zv);
+ if (zv != precv->op2.zv) {
+ zval_ptr_dtor(&zv);
+ }
}
}
string_write(str, " ]", sizeof(" ]")-1);