Ensure proper exception handling and EX(opline) state in USER_OPCODE handler

This commit is contained in:
Bob Weinand 2015-09-24 20:33:37 +02:00
parent 0fd7acd11d
commit 808f62bb4d
2 changed files with 14 additions and 2 deletions

View File

@ -7176,10 +7176,14 @@ ZEND_VM_HANDLER(150, ZEND_USER_OPCODE, ANY, ANY)
SAVE_OPLINE();
ret = zend_user_opcode_handlers[opline->opcode](execute_data);
LOAD_OPLINE();
if (EG(exception)) {
HANDLE_EXCEPTION();
}
switch (ret) {
case ZEND_USER_OPCODE_CONTINUE:
LOAD_OPLINE();
ZEND_VM_CONTINUE();
case ZEND_USER_OPCODE_RETURN:
if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_GENERATOR) != 0)) {
@ -7194,8 +7198,10 @@ ZEND_VM_HANDLER(150, ZEND_USER_OPCODE, ANY, ANY)
case ZEND_USER_OPCODE_LEAVE:
ZEND_VM_LEAVE();
case ZEND_USER_OPCODE_DISPATCH:
ZEND_ASSERT(EX(opline) == opline);
ZEND_VM_DISPATCH(opline->opcode, opline);
default:
ZEND_ASSERT(EX(opline) == opline);
ZEND_VM_DISPATCH((zend_uchar)(ret & 0xff), opline);
}
}

View File

@ -1563,10 +1563,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_USER_OPCODE_SPEC_HANDLER(ZEND_
SAVE_OPLINE();
ret = zend_user_opcode_handlers[opline->opcode](execute_data);
LOAD_OPLINE();
if (EG(exception)) {
HANDLE_EXCEPTION();
}
switch (ret) {
case ZEND_USER_OPCODE_CONTINUE:
LOAD_OPLINE();
ZEND_VM_CONTINUE();
case ZEND_USER_OPCODE_RETURN:
if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_GENERATOR) != 0)) {
@ -1581,8 +1585,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_USER_OPCODE_SPEC_HANDLER(ZEND_
case ZEND_USER_OPCODE_LEAVE:
ZEND_VM_LEAVE();
case ZEND_USER_OPCODE_DISPATCH:
ZEND_ASSERT(EX(opline) == opline);
ZEND_VM_DISPATCH(opline->opcode, opline);
default:
ZEND_ASSERT(EX(opline) == opline);
ZEND_VM_DISPATCH((zend_uchar)(ret & 0xff), opline);
}
}