diff options
author | Eike Rathke <erack@redhat.com> | 2016-05-31 00:02:38 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-05-31 00:10:00 +0200 |
commit | c75ce37560c05271ba56c9dd0d98c5001e83cc2f (patch) | |
tree | e681158383b9a5b73b44191fd117189c066cba47 /xmloff | |
parent | d7834317c7c925e9096b464c5f5f3e7f76e3fda3 (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
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/style/xmlnumfe.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx index 235920df5fe8..121a3818c103 100644 --- a/xmloff/source/style/xmlnumfe.cxx +++ b/xmloff/source/style/xmlnumfe.cxx @@ -1347,7 +1347,7 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt { aEmbeddedStr = *pElemStr; } - else + else if (pElemStr->getLength() >= 2) { SvNumberformat::InsertBlanks( aEmbeddedStr, 0, (*pElemStr)[1] ); } @@ -1419,7 +1419,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; |