summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-05-31 00:02:38 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-05-31 05:51:03 +0000
commit7e8e2ef608c7fe2a1c6d6fa244534b85dc42362b (patch)
tree9d29d8131794a40f985dc7ef4ac454a4feca8dce /xmloff
parent0fac4acb32baf59558f46d42ce31751948f00da3 (diff)
prevent out of bounds string access
Yet another reminiscence of String to OUString conversion.. where the terminating NULL-character was obtained and SvNumberformat::InsertBlanks() effectively did nothing. Could be triggered already by entering an '_' underscore character as number format code, which is a place holder for blanks of the same width as the following character, which there isn't then yet. Change-Id: I0534e1417d4bd35e9e7ed4bd0170b9ea3b5fb575 (cherry picked from commit c75ce37560c05271ba56c9dd0d98c5001e83cc2f) Reviewed-on: https://gerrit.libreoffice.org/25693 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/style/xmlnumfe.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index 068ca832f3ab..5bbbdd3063a0 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -1295,7 +1295,7 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
{
aEmbeddedStr = *pElemStr;
}
- else
+ else if (pElemStr->getLength() >= 2)
{
SvNumberformat::InsertBlanks( aEmbeddedStr, 0, (*pElemStr)[1] );
}
@@ -1367,7 +1367,8 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
// (#i20396# the spaces may also be in embedded-text elements)
OUString aBlanks;
- SvNumberformat::InsertBlanks( aBlanks, 0, (*pElemStr)[1] );
+ if (pElemStr->getLength() >= 2)
+ SvNumberformat::InsertBlanks( aBlanks, 0, (*pElemStr)[1] );
AddToTextElement_Impl( aBlanks );
}
break;