From: Bob Weinand Date: Wed, 17 May 2017 17:56:49 +0000 (+0200) Subject: Fixed bug #74606 (Segfault within try/catch/finally nesting in Generators) X-Git-Tag: php-7.1.6RC1~4^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=649494c0ee54102ac4a6c62fd5faf38143efb107;p=php Fixed bug #74606 (Segfault within try/catch/finally nesting in Generators) Thanks to Nikita for pointing out the error source. --- 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); } } /* }}} */