com php-src: Fix bug #67497: eval with parse error causes segfault in generator: NEWS Zend/tests/generators/bug67497.phpt Zend/zend_generators.c
| From: | Nikita Popov | Date: | Wed, 02 Jul 2014 15:33:31 +0000 |
| Subject: | com php-src: Fix bug #67497: eval with parse error causes segfault in generator: NEWS Zend/tests/generators/bug67497.phpt Zend/zend_generators.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-79204@lists.php.net to get a copy of this message | ||
Commit: d9ebd0f3d696e42d7c7bd2b0176414534aed0ef1
Author: Nikita Popov <nikic@php.net> Wed, 2 Jul 2014 17:33:31 +0200
Parents: 22882a9d89712ff2b6ebc20a689a89452bba4dcd
Branches: PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d9ebd0f3d696e42d7c7bd2b0176414534aed0ef1
Log:
Fix bug #67497: eval with parse error causes segfault in generator
Bugs:
https://bugs.php.net/67497
Changed paths:
M NEWS
A Zend/tests/generators/bug67497.phpt
M Zend/zend_generators.c
Diff:
diff --git a/NEWS b/NEWS
index 4a84854..9bfa384 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,8 @@ PHP NEWS
match). (Bob)
. Fixed bug #67091 (make install fails to install libphp5.so on FreeBSD 10.0).
(Ferenc)
+ . Fixed buf #67497 (eval with parse error causes segmentation fault in
+ generator). (Nikita)
- CLI server:
. Implemented FR #67429 (CLI server is missing some new HTTP response codes).
diff --git a/Zend/tests/generators/bug67497.phpt b/Zend/tests/generators/bug67497.phpt
new file mode 100644
index 0000000..483857b
--- /dev/null
+++ b/Zend/tests/generators/bug67497.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #67467: eval with parse error causes segmentation fault in generator
+--FILE--
+<?php
+
+function gen() {
+ $a = 1;
+ yield $a;
+}
+
+@eval('abc');
+
+$values = gen();
+$values->next();
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c
index a5313dc..b9722b4 100644
--- a/Zend/zend_generators.c
+++ b/Zend/zend_generators.c
@@ -125,6 +125,7 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished
/* A fatal error / die occurred during the generator execution.. Trying to clean
* up the stack may not be safe in this case. */
if (CG(unclean_shutdown)) {
+ generator->execute_data = NULL;
return;
}