summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@frugalware.org>2011-11-21 01:24:07 +0100
committerMiklos Vajna <vmiklos@frugalware.org>2011-11-21 01:24:23 +0100
commitfcae5e4103bb16bd44a48c2b63dcbafa9b438a9e (patch)
tree764884f252d9f43dd52d92409612e823bbb0ebf4 /writerfilter
parent0218f14776d14a67f8524a798d0defbda042d4d1 (diff)
Related: i#86517 avoid crash on invalid LEVELTEXT
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index ffc3846547b6..3b799370838a 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2794,7 +2794,11 @@ int RTFDocumentImpl::popState()
// The first character is the length of the string (the rest should be ignored).
sal_Int32 nLength(aStr.toChar());
- OUString aValue = aStr.copy(1, nLength);
+ OUString aValue;
+ if (nLength <= aStr.getLength())
+ aValue = aStr.copy(1, nLength);
+ else
+ aValue = aStr;
RTFValue::Pointer_t pValue(new RTFValue(aValue, true));
m_aStates.top().aTableAttributes->push_back(make_pair(NS_ooxml::LN_CT_LevelText_val, pValue));