com php-src: Fix bug #69599: NEWS Zend/tests/bug69599.phpt Zend/zend_vm_def.h Zend/zend_vm_execute.h
| From: | Nikita Popov | Date: | Tue, 12 May 2015 13:08:12 +0000 |
| Subject: | com php-src: Fix bug #69599: NEWS Zend/tests/bug69599.phpt Zend/zend_vm_def.h Zend/zend_vm_execute.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-86693@lists.php.net to get a copy of this message | ||
Commit: e1cb22a23e881d13ddf80a90f1b0bf2d37913f75
Author: Nikita Popov <nikic@php.net> Tue, 12 May 2015 15:08:12 +0200
Parents: 33594b78ec533127282a542d1e78b62df9e2dd4f
Branches: PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e1cb22a23e881d13ddf80a90f1b0bf2d37913f75
Log:
Fix bug #69599
Bugs:
https://bugs.php.net/69599
Changed paths:
M NEWS
A Zend/tests/bug69599.phpt
M Zend/zend_vm_def.h
M Zend/zend_vm_execute.h
Diff:
diff --git a/NEWS b/NEWS
index 526d580..104c99d 100644
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,7 @@ PHP NEWS
(Nikita)
. Fixed bug #69472 (php_sys_readlink ignores misc errors from
GetFinalPathNameByHandleA). (Jan Starke)
+ . Fixed bug #69599 (Strange generator+exception+variadic crash). (Nikita)
- Iconv:
. Fixed bug #48147 (iconv with //IGNORE cuts the string). (Stas)
diff --git a/Zend/tests/bug69599.phpt b/Zend/tests/bug69599.phpt
new file mode 100644
index 0000000..fa8eaa3
--- /dev/null
+++ b/Zend/tests/bug69599.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #69599: Strange generator+exception+variadic crash
+--FILE--
+<?php
+
+function crash() {
+ sin(...[0]);
+ throw new \Exception();
+ yield;
+}
+
+iterator_to_array(crash());
+
+?>
+--EXPECTF--
+Fatal error: Uncaught exception 'Exception' in %s:%d
+Stack trace:
+#0 [internal function]: crash()
+#1 %s(%d): iterator_to_array(Object(Generator))
+#2 {main}
+ thrown in %s on line %d
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index dbac90c..7c029ad 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -1887,7 +1887,7 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
EX(call)--;
- zend_vm_stack_clear_multiple(1 TSRMLS_CC);
+ zend_vm_stack_clear_multiple(0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
zend_throw_exception_internal(NULL TSRMLS_CC);
@@ -2075,7 +2075,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
EX(call)--;
- zend_vm_stack_clear_multiple(1 TSRMLS_CC);
+ zend_vm_stack_clear_multiple(0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
zend_throw_exception_internal(NULL TSRMLS_CC);
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 0db76ed..1f5e55f 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -459,7 +459,7 @@ static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
EX(call)--;
- zend_vm_stack_clear_multiple(1 TSRMLS_CC);
+ zend_vm_stack_clear_multiple(0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
zend_throw_exception_internal(NULL TSRMLS_CC);
@@ -647,7 +647,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
EX(call)--;
- zend_vm_stack_clear_multiple(1 TSRMLS_CC);
+ zend_vm_stack_clear_multiple(0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
zend_throw_exception_internal(NULL TSRMLS_CC);