Kaydet (Commit) 9bcfb6f0 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

add some more safety checks for row and column import from ODS

Change-Id: Ic714c65cfe93198c462ba55752223f4e60e5aad9
üst 3e85d9c6
......@@ -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();
......
......@@ -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:
......
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment