com php-src: Fixed invalid write in vsprintf tests: Zend/zend_execute_API.c ext/standard/formatted_print .c
| From: | Dmitry Stogov | Date: | Mon, 24 Feb 2014 09:26:09 +0000 |
| Subject: | com php-src: Fixed invalid write in vsprintf tests: Zend/zend_execute_API.c ext/standard/formatted_print .c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-77978@lists.php.net to get a copy of this message | ||
Commit: 479b82c0d4c4c0cf3f3ccb4333ba9f2d8df65edd
Author: Xinchen Hui <laruence@gmail.com> Mon, 24 Feb 2014 17:26:09 +0800
Parents: 0b37b90ec40eeaa6963130e864eba02bea9d39ce
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=479b82c0d4c4c0cf3f3ccb4333ba9f2d8df65edd
Log:
Fixed invalid write in vsprintf tests
Changed paths:
M Zend/zend_execute_API.c
M ext/standard/formatted_print.c
Diff:
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 26791c3..0bb4c6f 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -251,14 +251,14 @@ void shutdown_executor(TSRMLS_D) /* {{{ */
* so that if handler used some class, crash would not happen */
if (Z_TYPE(EG(user_error_handler)) != IS_UNDEF) {
zeh = &EG(user_error_handler);
- ZVAL_UNDEF(&EG(user_error_handler));
zval_ptr_dtor(zeh);
+ ZVAL_UNDEF(&EG(user_error_handler));
}
if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) {
zeh = &EG(user_exception_handler);
- ZVAL_UNDEF(&EG(user_exception_handler));
zval_ptr_dtor(zeh);
+ ZVAL_UNDEF(&EG(user_exception_handler));
}
zend_stack_destroy(&EG(user_error_handlers_error_reporting));
diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c
index 6317c82..b8724de 100644
--- a/ext/standard/formatted_print.c
+++ b/ext/standard/formatted_print.c
@@ -395,9 +395,7 @@ php_formatted_print(int param_count, int use_array, int format_offset TSRMLS_DC)
zval array;
z_format = &args[format_offset];
- ZVAL_COPY_VALUE(&array, &args[1 + format_offset]);
-
- SEPARATE_ZVAL(&array);
+ ZVAL_DUP(&array, &args[1 + format_offset]);
convert_to_array_ex(&array);
argc = 1 + zend_hash_num_elements(Z_ARRVAL(array));
@@ -411,6 +409,7 @@ php_formatted_print(int param_count, int use_array, int format_offset TSRMLS_DC)
i++;
}
efree(args);
+ zval_dtor(&array);
args = newargs;
format_offset = 0;
}