diff options
author | Tushar Bende <tushar.bende@synerzip.com> | 2014-06-04 15:04:18 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-09-12 19:23:50 +0200 |
commit | bea4100cd9ad62637a7ed33488f2a17769aa519a (patch) | |
tree | 65d8293fbd1128398e53d940b5a1e3e455978401 | |
parent | 7c3dd4a9c1a05bbb6867ca6db6229da38f5f68ed (diff) |
fdo#79535 :LO writer crash while Opening some document.
Problem Description : While setting ExtraData for Redline LO calls SwRangeRedline::SetExtraData() with
argument of type SwRedlineExtraData_FormattingChanges* which contains SfxItemSet*
In function SwRedlineExtraData_FormattingChanges() without Null checking SfxItemSet*,
LO was trying to get rCpy.pSet->Count() which was the reason for segmentation fault
while opening some documents in LO.
Added Null check before accessing a pointer.
Change-Id: I33299d2be2777ab6a8af0621595c9453145f1069
Reviewed-on: https://gerrit.libreoffice.org/9647
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit 8fcd4bf323bc3390e366229d549641444b5a3e9a)
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/fdo79535.docx | bin | 0 -> 22547 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 11 | ||||
-rw-r--r-- | sw/source/core/doc/docredln.cxx | 3 |
3 files changed, 13 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/fdo79535.docx b/sw/qa/extras/ooxmlimport/data/fdo79535.docx Binary files differnew file mode 100644 index 000000000000..64aab18e0ad7 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/fdo79535.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 9dab8ead1072..305b6edc9f03 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -2164,6 +2164,17 @@ DECLARE_OOXMLIMPORT_TEST(testFdo78883, "fdo78883.docx") CPPUNIT_ASSERT(xCursor->getPage() > sal_Int16(0)); } +DECLARE_OOXMLIMPORT_TEST(testFdo79535, "fdo79535.docx") +{ + // fdo#79535 : LO was crashing while opening document + // Checking there is a single page after loading a doc successfully in LO. + uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY); + uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); + xCursor->jumpToLastPage(); + CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xCursor->getPage()); +} + DECLARE_OOXMLIMPORT_TEST(testBnc875718, "bnc875718.docx") { // The frame in the footer must not accidentally end up in the document body. diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 64887a11f1b5..cb1520a7af71 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -3204,7 +3204,8 @@ SwRedlineExtraData_FormattingChanges::SwRedlineExtraData_FormattingChanges( cons SwRedlineExtraData_FormattingChanges::SwRedlineExtraData_FormattingChanges( const SwRedlineExtraData_FormattingChanges& rCpy ) : SwRedlineExtraData() { - if( rCpy.pSet->Count() ) + // Checking pointer pSet before accessing it for Count + if( rCpy.pSet && rCpy.pSet->Count() ) { pSet = new SfxItemSet( *(rCpy.pSet) ); } |