[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Sep 13 03:41:58 PDT 2012


 sw/source/core/unocore/unosect.cxx |    8 ++++++++
 1 file changed, 8 insertions(+)

New commits:
commit d026212d51cd7fe0dbcfe3a28bd15675528723ff
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Sep 12 21:01:41 2012 +0200

    fdo#42450: fix crash in SwXTextSection::attach:
    
    Inserting the section can fail if the given text range is not valid.
    
    (cherry picked from commit 5bc6c7b2e170a35914d7cd07347c77a9c9d23664
     and commit 2940a697dce2292e9c5b118feb8ec4159e3606fa)
    
    Change-Id: Ib6ba3b02dd581dce08b646b841354073caf894b2
    Reviewed-on: https://gerrit.libreoffice.org/604
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
    Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
    Tested-by: Miklos Vajna <vmiklos at suse.cz>

diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 1524d82..729ce0d 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -399,6 +399,14 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
 
     SwSection *const pRet =
         pDoc->InsertSwSection( aPam, aSect, 0, aSet.Count() ? &aSet : 0 );
+    if (!pRet) // fdo#42450 text range could parially overlap existing section
+    {
+        // shouldn't have created an undo object yet
+        pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_INSSECTION, NULL );
+        throw lang::IllegalArgumentException(
+                ::rtl::OUString::createFromAscii("SwXTextSection::attach(): invalid TextRange"),
+                static_cast< ::cppu::OWeakObject*>(this), 0);
+    }
     pRet->GetFmt()->Add(m_pImpl.get());
     pRet->GetFmt()->SetXObject(static_cast< ::cppu::OWeakObject*>(this));
 


More information about the Libreoffice-commits mailing list