summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-04-03 17:36:26 +0200
committerMiklos Vajna <vmiklos@suse.cz>2013-04-03 17:38:00 +0200
commit008275d56f9ac5248f0e94f606671b4c1993ca20 (patch)
tree1136f9912c7e090678619dff1166fed08efc33d5 /writerfilter
parent7006ef460bb68d27a74381fab7b8826b786b31c6 (diff)
fdo#51916 out of bounds substring access
Change-Id: I7db46ef17b8aed443faa7eb0c13b6ba109242cc1
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 0714b1579a68..d10a5a0b7951 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3940,11 +3940,14 @@ int RTFDocumentImpl::popState()
// extract default text
nLength = aStr.toChar();
aStr = aStr.copy(1);
- OString aDefaultText = aStr.copy(0, nLength);
RTFValue::Pointer_t pNValue(new RTFValue(OStringToOUString(aName, aState.nCurrentEncoding)));
m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFData_name, pNValue);
- RTFValue::Pointer_t pDValue(new RTFValue(OStringToOUString(aDefaultText, aState.nCurrentEncoding)));
- m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFTextInput_default, pDValue);
+ if (nLength > 0)
+ {
+ OString aDefaultText = aStr.copy(0, nLength);
+ RTFValue::Pointer_t pDValue(new RTFValue(OStringToOUString(aDefaultText, aState.nCurrentEncoding)));
+ m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFTextInput_default, pDValue);
+ }
m_bFormField = false;
}