com php-src: Fix incorrect literal freeing if pass_two gene rates fatal error: Zend/zend_opcode.c
| From: | Nikita Popov | Date: | Tue, 04 Sep 2018 06:08:39 +0000 |
| Subject: | com php-src: Fix incorrect literal freeing if pass_two gene rates fatal error: Zend/zend_opcode.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-102985@lists.php.net to get a copy of this message | ||
Commit: d36230fcaba46cc5b3ad54ced9337eee404c6b1b
Author: Nikita Popov <nikita.ppv@gmail.com> Tue, 4 Sep 2018 08:08:39 +0200
Parents: 63072e9c0ebbb676cd39d0f867d873737c676add
Branches: PHP-7.3 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d36230fcaba46cc5b3ad54ced9337eee404c6b1b
Log:
Fix incorrect literal freeing if pass_two generates fatal error
Changed paths:
M Zend/zend_opcode.c
Diff:
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index 6bed3c7..1e82dc7 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -546,6 +546,10 @@ ZEND_API int pass_two(zend_op_array *op_array)
CG(context).literals_size = op_array->last_literal;
#endif
+ /* Needs to be set directly after the opcode/literal reallocation, to ensure destruction
+ * happens correctly if any of the following fixups generate a fatal error. */
+ op_array->fn_flags |= ZEND_ACC_DONE_PASS_TWO;
+
opline = op_array->opcodes;
end = opline + op_array->last;
while (opline < end) {
@@ -674,7 +678,6 @@ ZEND_API int pass_two(zend_op_array *op_array)
}
}
- op_array->fn_flags |= ZEND_ACC_DONE_PASS_TWO;
return 0;
}