summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2012-01-23 15:43:50 +0100
committerKohei Yoshida <kohei.yoshida@suse.com>2012-01-23 11:09:37 -0500
commit2ec3bc43e1d00ae1911397883976c3724f0bfe14 (patch)
treef64a8a430e42230ecd27e7fface173401ed9c445
parent531b11d98d5fedd575d5e1564a937ac109d6bdf5 (diff)
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: Kohei Yoshida <kohei.yoshida@suse.com>
-rw-r--r--sc/source/core/tool/interpr4.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index c3992053ce3a..5a36165810e4 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -1286,6 +1286,8 @@ ScDBRangeBase* ScInterpreter::PopDBDoubleRef()
pMat = PopMatrix();
else
PopExternalDoubleRef(pMat);
+ if (nGlobalError)
+ break;
return new ScDBExternalRange(pDok, pMat);
}
default:
@@ -1542,7 +1544,14 @@ void ScInterpreter::PopExternalDoubleRef(ScMatrixRef& rMat)
// references, which means the array should only contain a
// single matrix token.
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(