diff options
-rw-r--r-- | sc/source/core/tool/interpr4.cxx | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 002c7de4c1da..170e60f6afca 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -3982,9 +3982,20 @@ StackVar ScInterpreter::Interpret() (*aTokenMatrixMapIter).second->GetType() != svJumpMatrix) { // Path already calculated, reuse result. - nStackBase = sp - pCur->GetParamCount(); - if ( nStackBase > sp ) - nStackBase = sp; // underflow?!? + if (sp >= pCur->GetParamCount()) + nStackBase = sp - pCur->GetParamCount(); + else + { + SAL_WARN("sc.core", "Stack anomaly with calculated path at " + << aPos.Tab() << "," << aPos.Col() << "," << aPos.Row() + << " " << aPos.Format( + ScRefFlags::VALID | ScRefFlags::FORCE_DOC | ScRefFlags::TAB_3D, pDok) + << " eOp: " << static_cast<int>(eOp) + << " params: " << static_cast<int>(pCur->GetParamCount()) + << " nStackBase: " << nStackBase << " sp: " << sp); + nStackBase = sp; + assert(!"underflow"); + } sp = nStackBase; PushTokenRef( (*aTokenMatrixMapIter).second); } |