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:48:42 +0100 |
commit | dfdbf14006d4baf822f399821dfb9d5412f8ab9e (patch) | |
tree | 5a8b46b9311d79e7bf83bb026fe3092ec7317ca1 | |
parent | 99f3e0807d911f1190664692a04db9cded8260c9 (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 e27267d4c00d..41bd60cddcc6 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). |