[Libreoffice-commits] core.git: writerfilter/source

Caolán McNamara caolanm at redhat.com
Wed Nov 6 16:07:59 CET 2013


 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 0325093fdfbb150f8a5176c56cc1a4803ffd1c80
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Nov 6 15:03:41 2013 +0000

    check for empty string
    
    as demonstrated by ooo29618-1.doc
    
    Change-Id: I81c953530cd3a617a245ed03a9c355f3383045ab

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index eea9498..f6f3b36b 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -4046,12 +4046,15 @@ int RTFDocumentImpl::popState()
                     aStr = aStr.copy(8);
                 // extract name
                 int nLength = aStr.toChar();
-                aStr = aStr.copy(1);
+                if (!aStr.isEmpty())
+                    aStr = aStr.copy(1);
                 OString aName = aStr.copy(0, nLength);
-                aStr = aStr.copy(nLength+1); // zero-terminated string
+                if (!aStr.isEmpty())
+                    aStr = aStr.copy(nLength+1); // zero-terminated string
                 // extract default text
                 nLength = aStr.toChar();
-                aStr = aStr.copy(1);
+                if (!aStr.isEmpty())
+                    aStr = aStr.copy(1);
                 RTFValue::Pointer_t pNValue(new RTFValue(OStringToOUString(aName, aState.nCurrentEncoding)));
                 m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFData_name, pNValue);
                 if (nLength > 0)


More information about the Libreoffice-commits mailing list