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:12:39 -0500
commit9faf077b85098436ac29b9369bfc7d8a9286fbd3 (patch)
tree2cb30b6c43616d631630d99b976696bd4545f576
parent12f883d3601bb695e589ab8b570d81d789c4bf64 (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.
-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 07ff54b51..424c71358 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -1285,6 +1285,8 @@ ScDBRangeBase* ScInterpreter::PopDBDoubleRef()
pMat = PopMatrix();
else
PopExternalDoubleRef(pMat);
+ if (nGlobalError)
+ break;
return new ScDBExternalRange(pDok, pMat);
}
default:
@@ -1535,7 +1537,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(