[Libreoffice-commits] core.git: sw/qa sw/source
Mike Kaganski
mike.kaganski at collabora.com
Fri Jan 19 05:45:14 UTC 2018
sw/qa/extras/uiwriter/data/tdf115065.odt |binary
sw/qa/extras/uiwriter/uiwriter.cxx | 27 +++++++++++++++++++++++++++
sw/source/core/crsr/swcrsr.cxx | 4 ++--
3 files changed, 29 insertions(+), 2 deletions(-)
New commits:
commit 13e55cedd2944c41f3f4fe7032cfea1ef9e6015d
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date: Thu Jan 18 14:21:58 2018 +0300
tdf#115065: nullptr dereference
Change-Id: Iafaaafdabf9fb7947fa0b03cd38d3b4a567a41b9
Reviewed-on: https://gerrit.libreoffice.org/48110
Reviewed-by: Michael Stahl <mstahl at redhat.com>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/sw/qa/extras/uiwriter/data/tdf115065.odt b/sw/qa/extras/uiwriter/data/tdf115065.odt
new file mode 100644
index 000000000000..86fc28aaf686
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf115065.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 7e3a0d54e533..f32c512d84de 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -297,6 +297,7 @@ public:
void testTdf113481();
void testTdf115013();
void testTdf114536();
+ void testTdf115065();
CPPUNIT_TEST_SUITE(SwUiWriterTest);
CPPUNIT_TEST(testReplaceForward);
@@ -473,6 +474,7 @@ public:
CPPUNIT_TEST(testTdf113481);
CPPUNIT_TEST(testTdf115013);
CPPUNIT_TEST(testTdf114536);
+ CPPUNIT_TEST(testTdf115065);
CPPUNIT_TEST_SUITE_END();
private:
@@ -5805,6 +5807,31 @@ void SwUiWriterTest::testTdf115013()
CPPUNIT_ASSERT_EQUAL(sColumnName, sColumn);
}
+void SwUiWriterTest::testTdf115065()
+{
+ // In the document, the tables have table style assigned
+ // Source table (first one) has two rows;
+ // destination (second one) has only one row
+ SwDoc* pDoc = createDoc("tdf115065.odt");
+ CPPUNIT_ASSERT(pDoc);
+ SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+ CPPUNIT_ASSERT(pWrtShell);
+
+ pWrtShell->GotoTable("Table2");
+ SwRect aRect = pWrtShell->GetCurrFrame()->getFrameArea();
+ // Destination point is the middle of the first cell of second table
+ Point ptTo = Point(aRect.Left() + aRect.Width() / 2, aRect.Top() + aRect.Height() / 2);
+
+ pWrtShell->GotoTable("Table1");
+ aRect = pWrtShell->GetCurrFrame()->getFrameArea();
+ // Source point is the middle of the first cell of first table
+ Point ptFrom = Point(aRect.Left() + aRect.Width() / 2, aRect.Top() + aRect.Height() / 2);
+
+ pWrtShell->SelTableCol();
+ // The copy operation (or closing document after that) segfaulted
+ pWrtShell->Copy(pWrtShell, ptFrom, ptTo);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 973880821359..4705f5c625ac 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -2265,8 +2265,8 @@ void SwTableCursor::DeleteBox(size_t const nPos)
bool SwTableCursor::NewTableSelection()
{
bool bRet = false;
- const SwNode *pStart = GetContentNode()->FindTableBoxStartNode();
- const SwNode *pEnd = GetContentNode(false)->FindTableBoxStartNode();
+ const SwNode *pStart = GetNode().FindTableBoxStartNode();
+ const SwNode *pEnd = GetNode(false).FindTableBoxStartNode();
if( pStart && pEnd )
{
const SwTableNode *pTableNode = pStart->FindTableNode();
More information about the Libreoffice-commits
mailing list