diff options
-rw-r--r-- | sc/source/filter/xml/xmlcelli.cxx | 12 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlcoli.cxx | 3 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlrowi.cxx | 1 |
3 files changed, 15 insertions, 1 deletions
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index 5a5d73f66681..f3eca237d1a9 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -833,6 +833,12 @@ void ScXMLTableRowCellContext::AddTextAndValueCells( const ScAddress& rCellPos, for (SCCOL i = 0; i < nColsRepeated; ++i) { rCurrentPos.SetCol( rCellPos.Col() + i ); + + // it makes no sense to import data after the last supported column + // fdo#58539 & gnome#627150 + if(rCurrentPos.Col() > MAXCOL) + break; + if (i > 0) rTables.AddColumn(false); if (!bIsEmpty) @@ -840,6 +846,12 @@ void ScXMLTableRowCellContext::AddTextAndValueCells( const ScAddress& rCellPos, for (SCROW j = 0; j < nRepeatedRows; ++j) { rCurrentPos.SetRow( rCellPos.Row() + j ); + + // it makes no sense to import data after last supported row + // fdo#58539 & gnome#627150 + if(rCurrentPos.Row() > MAXROW) + break; + if( (rCurrentPos.Col() == 0) && (j > 0) ) { rTables.AddRow(); diff --git a/sc/source/filter/xml/xmlcoli.cxx b/sc/source/filter/xml/xmlcoli.cxx index 688300e27df3..ed892944e65a 100644 --- a/sc/source/filter/xml/xmlcoli.cxx +++ b/sc/source/filter/xml/xmlcoli.cxx @@ -66,7 +66,8 @@ ScXMLTableColContext::ScXMLTableColContext( ScXMLImport& rImport, { case XML_TOK_TABLE_COL_ATTR_REPEATED: { - nColCount = sValue.toInt32(); + nColCount = std::max<sal_Int32>(sValue.toInt32(), 1); + nColCount = std::min<sal_Int32>(nColCount, MAXCOLCOUNT); } break; case XML_TOK_TABLE_COL_ATTR_STYLE_NAME: diff --git a/sc/source/filter/xml/xmlrowi.cxx b/sc/source/filter/xml/xmlrowi.cxx index 67d1f23ae43a..a4434e1b2a37 100644 --- a/sc/source/filter/xml/xmlrowi.cxx +++ b/sc/source/filter/xml/xmlrowi.cxx @@ -83,6 +83,7 @@ ScXMLTableRowContext::ScXMLTableRowContext( ScXMLImport& rImport, case XML_TOK_TABLE_ROW_ATTR_REPEATED: { nRepeatedRows = std::max( sValue.toInt32(), (sal_Int32) 1 ); + nRepeatedRows = std::min( nRepeatedRows, MAXROWCOUNT ); } break; case XML_TOK_TABLE_ROW_ATTR_DEFAULT_CELL_STYLE_NAME: |