summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-01-03 02:18:25 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-01-03 02:21:28 +0100
commit5693934456f917861af7cb02734578b049a46940 (patch)
tree0fbda9a634e49a6ae2dbb1d6c0c01442416b2db4
parent96e7e3564b473944218ea2f5440c70399e978e14 (diff)
limit the number of imported digits, fdo#58539
This should fix the crash with gnome#627420. Change-Id: Ibfff498282dc1c6fe9124ced645392107ef8829f
-rw-r--r--xmloff/source/style/xmlnumfi.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 7b0799cc80cc..8b57734766d5 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 ))