com php-src: Fix crash when exception occurs during nested rope: Zend/tests/exception_in_nested_rope.phpt Zend/zend_ execute.c

From: Date: Mon, 06 Jul 2015 18:53:54 +0000
Subject: com php-src: Fix crash when exception occurs during nested rope: Zend/tests/exception_in_nested_rope.phpt Zend/zend_ execute.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-87775@lists.php.net to get a copy of this message
Commit: 724051e3bd0b8618edd1dd3f29f27939efefff08 Author: Nikita Popov <nikic@php.net> Mon, 6 Jul 2015 20:53:54 +0200 Parents: 89ce8d28dee671eead485077bc97c2b800790d68 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=724051e3bd0b8618edd1dd3f29f27939efefff08 Log: Fix crash when exception occurs during nested rope Adds extra condition that the rope var of INIT/ADD must match the one one END. Changed paths: A Zend/tests/exception_in_nested_rope.phpt M Zend/zend_execute.c Diff: diff --git a/Zend/tests/exception_in_nested_rope.phpt b/Zend/tests/exception_in_nested_rope.phpt new file mode 100644 index 0000000..df0d6fb --- /dev/null +++ b/Zend/tests/exception_in_nested_rope.phpt @@ -0,0 +1,17 @@ +--TEST-- +Exception during nested rope +--FILE-- +<?php + +set_error_handler(function() { throw new Exception; }); + +try { + $a = "foo"; + $str = "$a${"y$a$a"}y"; +} catch (Exception $e) { + echo "Exception\n"; +} + +?> +--EXPECT-- +Exception diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 88d0135..6122566 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -2522,7 +2522,8 @@ static zend_always_inline void i_cleanup_unfinished_execution(zend_execute_data } else if (brk_opline->opcode == ZEND_ROPE_END) { zend_string **rope = (zend_string **) EX_VAR(brk_opline->op1.var); zend_op *last = EX(func)->op_array.opcodes + op_num; - while (last->opcode != ZEND_ROPE_ADD && last->opcode != ZEND_ROPE_INIT) { + while ((last->opcode != ZEND_ROPE_ADD && last->opcode != ZEND_ROPE_INIT) + || last->result.var != brk_opline->op1.var) { ZEND_ASSERT(last >= EX(func)->op_array.opcodes); last--; }

« previous php.cvs (#87775) next »