diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-01-03 01:41:45 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-01-03 01:43:39 +0100 |
commit | fa1b00095011def26cc291e74948817632e3545d (patch) | |
tree | 97f2ea6ab80d3ea8ee77fdc5244c359f638439db | |
parent | 669c27ca0575e046b37db7ecc0a3d24ed2001a62 (diff) |
don't overflow column number during import, fdo#58539
This should fix the crash with kde#245919
Change-Id: I7c3af01e27233d2f94d5585247c59e7d5b6ea8ca
-rw-r--r-- | sc/source/filter/xml/xmlsubti.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlsubti.hxx | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/sc/source/filter/xml/xmlsubti.cxx b/sc/source/filter/xml/xmlsubti.cxx index 2dddb907bcc8..1950e3c48d9d 100644 --- a/sc/source/filter/xml/xmlsubti.cxx +++ b/sc/source/filter/xml/xmlsubti.cxx @@ -220,6 +220,8 @@ void ScMyTables::AddColStyle(const sal_Int32 nRepeat, const rtl::OUString& rCell { rImport.GetStylesImportHelper()->AddColumnStyle(rCellStyleName, nCurrentColCount, nRepeat); nCurrentColCount += nRepeat; + SAL_WARN_IF(nCurrentColCount > MAXCOL, "sc", "more columns than fit into SCCOL"); + nCurrentColCount = std::min<sal_Int32>( nCurrentColCount, MAXCOL ); } uno::Reference< drawing::XDrawPage > ScMyTables::GetCurrentXDrawPage() diff --git a/sc/source/filter/xml/xmlsubti.hxx b/sc/source/filter/xml/xmlsubti.hxx index 2cdea7740299..b7707715a64d 100644 --- a/sc/source/filter/xml/xmlsubti.hxx +++ b/sc/source/filter/xml/xmlsubti.hxx @@ -87,7 +87,7 @@ public: ScXMLTabProtectionData& GetCurrentProtectionData() { return maProtectionData; } rtl::OUString GetCurrentSheetName() const { return sCurrentSheetName; } SCTAB GetCurrentSheet() const { return (maCurrentCellPos.Tab() >= 0) ? maCurrentCellPos.Tab() : 0; } - SCCOL GetCurrentColCount() const { return nCurrentColCount; } + SCCOL GetCurrentColCount() const { return std::min<sal_Int32>(nCurrentColCount, MAXCOL); } SCROW GetCurrentRow() const { return (maCurrentCellPos.Row() >= 0) ? maCurrentCellPos.Row() : 0; } ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet > GetCurrentXSheet() const { return xCurrentSheet; } |