Fix some stack overflow bugs

If re-entry triggers stack overflow, there is no FCall or FCallArray,
so the code to find the pc in REQ_STACK_OVERFLOW would fail. If it
managed to get through there, it would then try to DecRef the contents
of an ActRec, sometimes causing it to DecRef a Func.

In addition, if a "leaf" function resulted in re-entry we didn't
necessarily check the stack.

Differential Revision: D936843
Esse commit está contido em:
mwilliams
2013-08-20 18:56:28 -07:00
commit de Sara Golemon
commit 9e35396b7f
6 arquivos alterados com 58 adições e 17 exclusões
+4 -2
Ver Arquivo
@@ -1655,7 +1655,8 @@ void VMExecutionContext::invokeFunc(TypedValue* retval,
}
Cell* savedSP = m_stack.top();
if (f->numParams() > kStackCheckReenterPadding - kNumActRecCells) {
if (f->attrs() & AttrPhpLeafFn ||
f->numParams() > kStackCheckReenterPadding - kNumActRecCells) {
checkStack(m_stack, f);
}
@@ -1797,7 +1798,8 @@ void VMExecutionContext::invokeFuncFew(TypedValue* retval,
thiz->incRefCount();
}
Cell* savedSP = m_stack.top();
if (argc > kStackCheckReenterPadding - kNumActRecCells) {
if (f->attrs() & AttrPhpLeafFn ||
argc > kStackCheckReenterPadding - kNumActRecCells) {
checkStack(m_stack, f);
}
ActRec* ar = m_stack.allocA();