From 649494c0ee54102ac4a6c62fd5faf38143efb107 Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Wed, 17 May 2017 19:56:49 +0200 Subject: [PATCH] Fixed bug #74606 (Segfault within try/catch/finally nesting in Generators) Thanks to Nikita for pointing out the error source. --- NEWS | 2 ++ Zend/tests/generators/bug74606.phpt | 29 +++++++++++++++++++++++++++++ Zend/zend_generators.c | 2 +- 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 Zend/tests/generators/bug74606.phpt diff --git a/NEWS b/NEWS index fcc0f40baf..e5cafc9329 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,8 @@ PHP NEWS . Fixed bug #74546 (SIGILL in ZEND_FETCH_CLASS_CONSTANT_SPEC_CONST_CONST). (Laruence) . Fixed bug #74589 (__DIR__ wrong for unicode character). (Anatol) + . Fixed bug #74606 (Segfault within try/catch/finally nesting in Generators). + (Bob, Nikita) - intl: . Fixed bug #74468 (wrong reflection on Collator::sortWithSortKeys). (villfa) diff --git a/Zend/tests/generators/bug74606.phpt b/Zend/tests/generators/bug74606.phpt new file mode 100644 index 0000000000..cfb7f7f8cd --- /dev/null +++ b/Zend/tests/generators/bug74606.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #74606 (Segfault within try/catch/finally nesting in Generators) +--FILE-- +throw(new Exception); + +?> +--EXPECT-- +fin foo +catch +fin bar diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 945c3615ed..99145ada71 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -108,7 +108,7 @@ static void zend_generator_cleanup_unfinished_execution( if (UNEXPECTED(generator->frozen_call_stack)) { zend_generator_restore_call_stack(generator); } - zend_cleanup_unfinished_execution(execute_data, op_num, 0); + zend_cleanup_unfinished_execution(execute_data, op_num, catch_op_num); } } /* }}} */ -- 2.40.0