Kaydet (Commit) 2ec3bc43 authored tarafından Eike Rathke's avatar Eike Rathke Kaydeden (comit) Kohei Yoshida

resolved rhbz#783556 crash in ScMatrix::GetDimensons() from ScInterpreter

* Interpreter tried to access a nonexistent matrix for external reference.
* In ScInterpreter::PopExternalDoubleRef(ScMatrixRef& rMat) set error for
  unexpected conditions. In caller or descendants check for error or presence
  of ScMatrix.
Signed-off-by: 's avatarKohei Yoshida <kohei.yoshida@suse.com>
üst 531b11d9
...@@ -1286,6 +1286,8 @@ ScDBRangeBase* ScInterpreter::PopDBDoubleRef() ...@@ -1286,6 +1286,8 @@ ScDBRangeBase* ScInterpreter::PopDBDoubleRef()
pMat = PopMatrix(); pMat = PopMatrix();
else else
PopExternalDoubleRef(pMat); PopExternalDoubleRef(pMat);
if (nGlobalError)
break;
return new ScDBExternalRange(pDok, pMat); return new ScDBExternalRange(pDok, pMat);
} }
default: default:
...@@ -1542,7 +1544,14 @@ void ScInterpreter::PopExternalDoubleRef(ScMatrixRef& rMat) ...@@ -1542,7 +1544,14 @@ void ScInterpreter::PopExternalDoubleRef(ScMatrixRef& rMat)
// references, which means the array should only contain a // references, which means the array should only contain a
// single matrix token. // single matrix token.
ScToken* p = static_cast<ScToken*>(pArray->First()); ScToken* p = static_cast<ScToken*>(pArray->First());
rMat = p->GetMatrix(); if (!p || p->GetType() != svMatrix)
SetError( errIllegalParameter);
else
{
rMat = p->GetMatrix();
if (!rMat)
SetError( errUnknownVariable);
}
} }
void ScInterpreter::GetExternalDoubleRef( void ScInterpreter::GetExternalDoubleRef(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment