Blame SOURCES/0002-sw-fix-crash-on-SwUndoDelete-after-select-all-with-t.patch

ebc4bd
From 647ce83f41e7cda6ef8171c575c6c1ec5245b43f Mon Sep 17 00:00:00 2001
ebc4bd
From: Michael Stahl <mstahl@redhat.com>
ebc4bd
Date: Thu, 2 Apr 2015 23:33:41 +0200
ebc4bd
Subject: [PATCH 2/4] sw: fix crash on SwUndoDelete after select-all with table
ebc4bd
 at start
ebc4bd
MIME-Version: 1.0
ebc4bd
Content-Type: text/plain; charset=UTF-8
ebc4bd
Content-Transfer-Encoding: 8bit
ebc4bd
ebc4bd
Somehow the Redo leaves the shell cursor at an invalid offset into the
ebc4bd
paragraph, which then leads to out-of-bounds string access.
ebc4bd
ebc4bd
Noticed that SwUndRng::SetPaM() leaves an invalid nContent.m_nIndex on
ebc4bd
the start position, due to a surprising omission in SwIndex::ChgValue().
ebc4bd
ebc4bd
(regression from 555ff26501d1bbd8a7872c20671c6303db1e1701)
ebc4bd
ebc4bd
Change-Id: I6e6ad7f70835d7e9d6da1fb680e2ae15469fad71
ebc4bd
(cherry picked from commit b24a15a0aaea310806259eaa20a7d509ce30e5c8)
ebc4bd
Reviewed-on: https://gerrit.libreoffice.org/15128
ebc4bd
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
ebc4bd
Tested-by: Caolán McNamara <caolanm@redhat.com>
ebc4bd
(cherry picked from commit add86b9d5fcf3cb52549e64be148ba9e7bb4005e)
ebc4bd
---
ebc4bd
 sw/source/core/bastyp/index.cxx | 1 +
ebc4bd
 sw/source/core/edit/eddel.cxx   | 1 +
ebc4bd
 2 files changed, 2 insertions(+)
ebc4bd
ebc4bd
diff --git a/sw/source/core/bastyp/index.cxx b/sw/source/core/bastyp/index.cxx
ebc4bd
index 81da0bb..88eb691 100644
ebc4bd
--- a/sw/source/core/bastyp/index.cxx
ebc4bd
+++ b/sw/source/core/bastyp/index.cxx
ebc4bd
@@ -80,6 +80,7 @@ SwIndex& SwIndex::ChgValue( const SwIndex& rIdx, sal_Int32 nNewValue )
ebc4bd
     assert(m_pIndexReg == rIdx.m_pIndexReg);
ebc4bd
     if (!m_pIndexReg)
ebc4bd
     {
ebc4bd
+        m_nIndex = 0;
ebc4bd
         return *this; // no IndexReg => no list to sort into; m_nIndex is 0
ebc4bd
     }
ebc4bd
     SwIndex* pFnd = const_cast<SwIndex*>(&rIdx);
ebc4bd
diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx
ebc4bd
index fad1eaf..9e2c7b2 100644
ebc4bd
--- a/sw/source/core/edit/eddel.cxx
ebc4bd
+++ b/sw/source/core/edit/eddel.cxx
ebc4bd
@@ -98,6 +98,7 @@ void SwEditShell::DeleteSel( SwPaM& rPam, bool* pUndo )
ebc4bd
             // Selection starts at the first para of the first cell, but we
ebc4bd
             // want to delete the table node before the first cell as well.
ebc4bd
             pNewPam->Start()->nNode = pNewPam->Start()->nNode.GetNode().FindTableNode()->GetIndex();
ebc4bd
+            pNewPam->Start()->nContent.Assign(nullptr, 0);
ebc4bd
             pPam = pNewPam.get();
ebc4bd
         }
ebc4bd
         // delete everything
ebc4bd
-- 
ebc4bd
2.1.0
ebc4bd