Skip to content

Commit d36230f

Browse files
committed
Fix incorrect literal freeing if pass_two generates fatal error
1 parent 63072e9 commit d36230f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Zend/zend_opcode.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,10 @@ ZEND_API int pass_two(zend_op_array *op_array)
546546
CG(context).literals_size = op_array->last_literal;
547547
#endif
548548

549+
/* Needs to be set directly after the opcode/literal reallocation, to ensure destruction
550+
* happens correctly if any of the following fixups generate a fatal error. */
551+
op_array->fn_flags |= ZEND_ACC_DONE_PASS_TWO;
552+
549553
opline = op_array->opcodes;
550554
end = opline + op_array->last;
551555
while (opline < end) {
@@ -674,7 +678,6 @@ ZEND_API int pass_two(zend_op_array *op_array)
674678
}
675679
}
676680

677-
op_array->fn_flags |= ZEND_ACC_DONE_PASS_TWO;
678681
return 0;
679682
}
680683

0 commit comments

Comments
 (0)