[libreoffice] Related: fdo#42534 0001-Related-i58612-don-t-crash-anyway.patch

Caolán McNamara caolanm at fedoraproject.org
Thu Nov 10 15:26:39 UTC 2011


commit cb9196ad3691adbe029b0ee511768623501a1b2a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Nov 10 15:26:31 2011 +0000

    Related: fdo#42534 0001-Related-i58612-don-t-crash-anyway.patch

 0001-Related-i58612-don-t-crash-anyway.patch |  102 ++++++++++++++++++++++++++
 libreoffice.spec                             |    3 +
 2 files changed, 105 insertions(+), 0 deletions(-)
---
diff --git a/0001-Related-i58612-don-t-crash-anyway.patch b/0001-Related-i58612-don-t-crash-anyway.patch
new file mode 100644
index 0000000..47c81b9
--- /dev/null
+++ b/0001-Related-i58612-don-t-crash-anyway.patch
@@ -0,0 +1,102 @@
+From 3524727db0f3cfecf3a47046795c527808c10c3e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm at redhat.com>
+Date: Thu, 23 Jun 2011 15:14:00 +0100
+Subject: [PATCH] Related: #i58612# don't crash anyway
+
+---
+ sw/source/core/text/frmform.cxx |   11 ++++++-----
+ sw/source/core/text/inftxt.cxx  |    3 ++-
+ sw/source/core/text/txtfly.cxx  |    6 ++++--
+ sw/source/core/text/txtfrm.cxx  |    7 +++++--
+ 4 files changed, 17 insertions(+), 10 deletions(-)
+
+diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
+index 6a4be32..6b3b9cc 100755
+--- a/sw/source/core/text/frmform.cxx
++++ b/sw/source/core/text/frmform.cxx
+@@ -1463,10 +1463,11 @@ void SwTxtFrm::_Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf,
+ 
+     if( IsFollow() && IsFieldFollow() && rLine.GetStart() == GetOfst() )
+     {
+-        const SwLineLayout* pLine;
++        SwTxtFrm *pMaster = FindMaster();
++        OSL_ENSURE( pMaster, "SwTxtFrm::Format: homeless follow" );
++        const SwLineLayout* pLine=NULL;
++        if (pMaster)
+         {
+-            SwTxtFrm *pMaster = FindMaster();
+-            OSL_ENSURE( pMaster, "SwTxtFrm::Format: homeless follow" );
+             if( !pMaster->HasPara() )
+                 pMaster->GetFormatted();
+             SwTxtSizeInfo aInf( pMaster );
+@@ -1474,8 +1475,8 @@ void SwTxtFrm::_Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf,
+             aMasterLine.Bottom();
+             pLine = aMasterLine.GetCurr();
+         }
+-        SwLinePortion* pRest =
+-            rLine.MakeRestPortion( pLine, GetOfst() );
++        SwLinePortion* pRest = pLine ?
++            rLine.MakeRestPortion(pLine, GetOfst()) : NULL;
+         if( pRest )
+             rInf.SetRest( pRest );
+         else
+diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
+index 570b3c6..a76d746 100644
+--- a/sw/source/core/text/inftxt.cxx
++++ b/sw/source/core/text/inftxt.cxx
+@@ -1465,7 +1465,8 @@ void SwTxtFormatInfo::Init()
+     if ( GetTxtFrm()->IsFollow() )
+     {
+         const SwTxtFrm* pMaster = GetTxtFrm()->FindMaster();
+-        const SwLinePortion* pTmpPara = pMaster->GetPara();
++        OSL_ENSURE(pMaster, "pTxtFrm without Master");
++        const SwLinePortion* pTmpPara = pMaster ? pMaster->GetPara() : NULL;
+ 
+         // there is a master for this follow and the master does not have
+         // any contents (especially it does not have a number portion)
+diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
+index 2d21ece..fbff110 100644
+--- a/sw/source/core/text/txtfly.cxx
++++ b/sw/source/core/text/txtfly.cxx
+@@ -890,7 +890,7 @@ sal_Bool SwTxtFly::IsAnyObj( const SwRect &rRect ) const
+ const SwCntntFrm* SwTxtFly::_GetMaster()
+ {
+     pMaster = pCurrFrm;
+-    while( pMaster->IsFollow() )
++    while( pMaster && pMaster->IsFollow() )
+         pMaster = (SwCntntFrm*)pMaster->FindMaster();
+     return pMaster;
+ }
+@@ -1551,7 +1551,9 @@ SwAnchoredObjList* SwTxtFly::InitAnchoredObjList()
+ SwTwips SwTxtFly::CalcMinBottom() const
+ {
+     SwTwips nRet = 0;
+-    const SwSortedObjs *pDrawObj = GetMaster()->GetDrawObjs();
++    const SwCntntFrm *pLclMaster = GetMaster();
++    OSL_ENSURE(pLclMaster, "SwTxtFly without master");
++    const SwSortedObjs *pDrawObj = pLclMaster ? pLclMaster->GetDrawObjs() : NULL;
+     const sal_uInt32 nCount = pDrawObj ? pDrawObj->Count() : 0;
+     if( nCount )
+     {
+diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
+index 6e5f764..9e4a237 100644
+--- a/sw/source/core/text/txtfrm.cxx
++++ b/sw/source/core/text/txtfrm.cxx
+@@ -646,9 +646,12 @@ void SwTxtFrm::HideAndShowObjects()
+         }
+     }
+ 
+-    if ( IsFollow() )
++    if (IsFollow())
+     {
+-        FindMaster()->HideAndShowObjects();
++        SwTxtFrm *pMaster = FindMaster();
++        OSL_ENSURE(pMaster, "SwTxtFrm without master");
++        if (pMaster)
++            pMaster->HideAndShowObjects();
+     }
+ }
+ 
+-- 
+1.7.6.4
+
diff --git a/libreoffice.spec b/libreoffice.spec
index bcc966c..863fc0e 100644
--- a/libreoffice.spec
+++ b/libreoffice.spec
@@ -139,6 +139,7 @@ Patch34: 0001-wpsimport-writerperfect.diff-WPS-Import-filter-core-.patch
 Patch35: libreoffice-gcj.patch
 Patch36: libreoffice-rhel6poppler.patch
 %endif
+Patch37: 0001-Related-i58612-don-t-crash-anyway.patch
 
 %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
 %define instdir %{_libdir}
@@ -821,6 +822,7 @@ mv -f redhat.soc extras/source/palettes/standard.soc
 %patch35 -p1 -b .gcj.patch
 %patch36 -p0 -b .rhel6poppler.patch
 %endif
+%patch37 -p1 -b .i58612-don-t-crash-anyway.patch
 
 # these are horribly incomplete--empty translations and copied english
 # strings with spattering of translated strings
@@ -2124,6 +2126,7 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
 
 %changelog
 * Thu Nov 10 2011 Caolán McNamara <caolanm at redhat.com> - 3.4.4.2-3
+- Related: fdo#42534 0001-Related-i58612-don-t-crash-anyway.patch
 
 * Thu Nov 10 2011 Stephan Bergmann <sbergman at redhat.com> - 3.4.4.2-2
 - Patch to backport reading AES-encrypted ODF 1.2 documents


More information about the scm-commits mailing list