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

Michael Stahl mstahl at redhat.com
Wed Dec 13 12:59:36 UTC 2017


 sw/source/filter/ww8/wrtw8nds.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 07138b4f5cd5dc2585b9f63f68f3e2badd34d3c7
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Dec 13 13:06:49 2017 +0100

    sw: fix crash exporting tdf93816-2.odt to WW8
    
    The problem is that nLen = *aBreakIt - nAktPos - ofs; results in -12.
    
    It doesn't make sense to me that nEnd should still be the end of the
    paragraph in this case.
    
    Change-Id: I0c9df6a938035b3bc2c8857ef09206d8967c20f4

diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 76120b876fa4..54466b48f5d0 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -2318,7 +2318,7 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode )
 
         const OUString& aStr( rNode.GetText() );
 
-        sal_Int32 const nEnd = aStr.getLength();
+        sal_Int32 const nEnd = bNeedParaSplit ? *aBreakIt : aStr.getLength();
         bool bIncludeEndOfParaCRInRedlineProperties = false;
         sal_Int32 nOpenAttrWithRange = 0;
 
@@ -2496,8 +2496,10 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode )
                 nLen -= ofs;
 
                 // if paragraph needs to be split, write only until split position
+                assert(!bNeedParaSplit || nAktPos <= *aBreakIt);
                 if( bNeedParaSplit && nAktPos + ofs + nLen > *aBreakIt)
                     nLen = *aBreakIt - nAktPos - ofs;
+                assert(0 <= nLen);
 
                 OUString aSnippet( aAttrIter.GetSnippet( aStr, nAktPos + ofs, nLen ) );
                 if ( ( m_nTextTyp == TXT_EDN || m_nTextTyp == TXT_FTN ) && nAktPos == 0 && nLen > 0 )


More information about the Libreoffice-commits mailing list