[Libreoffice-commits] .: 2 commits - sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Sep 12 12:58:08 PDT 2012


 sw/source/core/docnode/ndsect.cxx  |    4 +++-
 sw/source/core/unocore/unosect.cxx |    6 ++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

New commits:
commit f6488227823a2a1f2f210ead00add0af02a2c0fd
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Sep 12 21:51:57 2012 +0200

    SwDoc::InsertSwSection translate assertion
    
    Change-Id: I225610dd844b081eb0c0e4e5b1e0f31188cb8062

diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index 8dd4023..81d495a 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -165,7 +165,9 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData,
     if( rRange.HasMark() &&
         0 == ( nRegionRet = IsInsRegionAvailable( rRange, &pPrvNd ) ))
     {
-        OSL_ENSURE( !this, "Selection ueber verschiedene Sections" );
+        // demoted to info because this is called from SwXTextSection::attach,
+        // so it could be invalid input
+        SAL_INFO("sw.core" , "InsertSwSection: rRange overlaps other sections");
         return 0;
     }
 
commit 5bc6c7b2e170a35914d7cd07347c77a9c9d23664
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.
    
    Change-Id: Ib6ba3b02dd581dce08b646b841354073caf894b2

diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 51016e2..4e68e30 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -400,6 +400,12 @@ 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
+    {
+        throw lang::IllegalArgumentException(
+                "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