diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-01-03 17:46:18 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-01-03 17:49:11 +0100 |
commit | 5bc348ae930b57f546238a8d24efebdd0972753c (patch) | |
tree | 939cf8ea8b94d16c4a24f84317823c212465f88c | |
parent | 95dbe79206b107a987914f8f97f26ca79da5dd2b (diff) |
make sure the column index is valid, fdo#58539
This is the first part of the fix for gnome#627150
Change-Id: I02cd8c553dd6b9a026c0ea38d77c6831fef6498e
-rw-r--r-- | sc/source/core/data/documen4.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlcelli.cxx | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx index 7e064ae5b673..b3bb256267a1 100644 --- a/sc/source/core/data/documen4.cxx +++ b/sc/source/core/data/documen4.cxx @@ -119,6 +119,8 @@ void ScDocument::InsertMatrixFormula(SCCOL nCol1, SCROW nRow1, { PutInOrder(nCol1, nCol2); PutInOrder(nRow1, nRow2); + nCol2 = std::min<SCCOL>(nCol2, MAXCOL); + nRow2 = std::min<SCROW>(nRow2, MAXROW); if (!rMark.GetSelectCount()) { SAL_WARN("sc", "ScDocument::InsertMatrixFormula Keine Tabelle markiert"); diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index 957cb67a35ac..398a49c90996 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -1063,8 +1063,8 @@ void ScXMLTableRowCellContext::AddFormulaCell( const ScAddress& rCellPos ) //value/text of each matrix cell later rXMLImport.GetTables().AddMatrixRange( rCellPos.Col(), rCellPos.Row(), - rCellPos.Col() + nMatrixCols - 1, - rCellPos.Row() + nMatrixRows - 1, + std::min<SCCOL>(rCellPos.Col() + nMatrixCols - 1, MAXCOL), + std::min<SCROW>(rCellPos.Row() + nMatrixRows - 1, MAXROW), pOUFormula->first, pOUFormula->second, eGrammar); //set the value/text of the first matrix position (top-left). |