[Libreoffice-commits] .: Branch 'libreoffice-4-0' - 2 commits - sc/source xmloff/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Jan 3 05:05:50 PST 2013
sc/source/filter/xml/xmlsubti.cxx | 2 ++
sc/source/filter/xml/xmlsubti.hxx | 2 +-
xmloff/source/style/xmlnumfi.cxx | 4 +++-
3 files changed, 6 insertions(+), 2 deletions(-)
New commits:
commit f373868e16a1d83ceda531e4965cb00eaa523b8a
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Jan 3 02:18:25 2013 +0100
limit the number of imported digits, fdo#58539
This should fix the crash with gnome#627420.
Change-Id: Ibfff498282dc1c6fe9124ced645392107ef8829f
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 28a4ec6..1ffae17 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -916,6 +916,8 @@ static void lcl_EnquoteIfNecessary( rtl::OUStringBuffer& rContent, const SvXMLNu
// SvXMLNumFmtElementContext
//
+const sal_Int32 MAX_SECOND_DIGITS = 20; // fdo#58539 & gnome#627420: limit number of digits during import
+
SvXMLNumFmtElementContext::SvXMLNumFmtElementContext( SvXMLImport& rImport,
sal_uInt16 nPrfx, const rtl::OUString& rLName,
SvXMLNumFormatContext& rParentContext, sal_uInt16 nNewType,
@@ -948,7 +950,7 @@ SvXMLNumFmtElementContext::SvXMLNumFmtElementContext( SvXMLImport& rImport,
{
case XML_TOK_ELEM_ATTR_DECIMAL_PLACES:
if (::sax::Converter::convertNumber( nAttrVal, sValue, 0 ))
- aNumInfo.nDecimals = nAttrVal;
+ aNumInfo.nDecimals = std::min<sal_Int32>(nAttrVal, MAX_SECOND_DIGITS);
break;
case XML_TOK_ELEM_ATTR_MIN_INTEGER_DIGITS:
if (::sax::Converter::convertNumber( nAttrVal, sValue, 0 ))
commit 74de75156f1ac6de427b62f000c6dcd248f914f6
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