[Libreoffice-commits] .: sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Jan 2 16:41:12 PST 2013
sc/source/filter/xml/xmlsubti.cxx | 2 ++
sc/source/filter/xml/xmlsubti.hxx | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
New commits:
commit fa1b00095011def26cc291e74948817632e3545d
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Jan 3 01:41:45 2013 +0100
don't overflow column number during import, fdo#58539
This should fix the crash with kde#245919
Change-Id: I7c3af01e27233d2f94d5585247c59e7d5b6ea8ca
diff --git a/sc/source/filter/xml/xmlsubti.cxx b/sc/source/filter/xml/xmlsubti.cxx
index 2dddb90..1950e3c 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 2cdea77..b770771 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; }
More information about the Libreoffice-commits
mailing list