summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-09-12 21:01:41 +0200
committerMichael Stahl <mstahl@redhat.com>2012-09-12 21:51:48 +0200
commit5bc6c7b2e170a35914d7cd07347c77a9c9d23664 (patch)
tree3afe1aed0a747ec228b3914da32322eeea5e1e31
parent1488e24a340333d4ddc954643b9cfd56849b45a4 (diff)
fdo#42450: fix crash in SwXTextSection::attach:
Inserting the section can fail if the given text range is not valid. Change-Id: Ib6ba3b02dd581dce08b646b841354073caf894b2
-rw-r--r--sw/source/core/unocore/unosect.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 51016e29eee3..4e68e309ffeb 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));