Re: com php-src: Fixed incorrect exception handling: Zend/zend_vm_def.h Zend/zend_vm_execute.h
| From: | Dmitry Stogov | Date: | Thu, 17 Dec 2015 14:40:23 +0000 |
| Subject: | Re: com php-src: Fixed incorrect exception handling: Zend/zend_vm_def.h Zend/zend_vm_execute.h | ||
| References: | 1 2 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-90319@lists.php.net to get a copy of this message | ||
The problem was triggered by Zend/tests/bug43175.phpt it just didn't make
any harm because of "luck".
However, it started lead to crash woth Bob's patch.
If you revert the patch, set breakpoint at the protected line and run
end/tests/bug43175.php, you'll see the problem.
On Thu, Dec 17, 2015 at 5:01 PM, Nikita Popov <nikita.ppv@gmail.com> wrote:
> On Thu, Dec 17, 2015 at 12:16 PM, Dmitry Stogov <dmitry@php.net> wrote:
>
>> Commit: 9e44b6a61e7ca116c3ea6de4080276ef9a650d06
>> Author: Dmitry Stogov <dmitry@zend.com> Thu, 17 Dec 2015
>> 14:16:19 +0300
>> Parents: 860ef0e2d7439214098430898fe15051ffc5e3a8
>> Branches: PHP-7.0 master
>>
>> Link:
>>
>> http://git.php.net/?p=php-src.git;a=commitdiff;h=9e44b6a61e7ca116c3ea6de4080276ef9a650d06
>>
>> Log:
>> Fixed incorrect exception handling
>>
>> Changed paths:
>> M Zend/zend_vm_def.h
>> M Zend/zend_vm_execute.h
>>
>>
>> Diff:
>> diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
>> index 4c01a5d..0e555f5 100644
>> --- a/Zend/zend_vm_def.h
>> +++ b/Zend/zend_vm_def.h
>> @@ -2383,7 +2383,7 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
>> if (UNEXPECTED(EG(exception) != NULL)) {
>> const zend_op *old_opline = EX(opline);
>> zend_throw_exception_internal(NULL);
>> - if (RETURN_VALUE_USED(old_opline)) {
>> + if (old_opline->opcode != ZEND_HANDLE_EXCEPTION
>> && RETURN_VALUE_USED(old_opline)) {
>>
>> zval_ptr_dtor(EX_VAR(old_opline->result.var));
>> }
>> HANDLE_EXCEPTION_LEAVE();
>> diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
>> index 0fd696d..8ef0c4d 100644
>> --- a/Zend/zend_vm_execute.h
>> +++ b/Zend/zend_vm_execute.h
>> @@ -501,7 +501,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL
>> zend_leave_helper_SPEC(ZEND_OPCODE_
>> if (UNEXPECTED(EG(exception) != NULL)) {
>> const zend_op *old_opline = EX(opline);
>> zend_throw_exception_internal(NULL);
>> - if (RETURN_VALUE_USED(old_opline)) {
>> + if (old_opline->opcode != ZEND_HANDLE_EXCEPTION
>> && RETURN_VALUE_USED(old_opline)) {
>>
>> zval_ptr_dtor(EX_VAR(old_opline->result.var));
>> }
>> HANDLE_EXCEPTION_LEAVE();
>>
>
> Do you have a test case for this issue?
>
> Nikita
>