diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-12-19 19:35:20 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-02-07 10:53:56 +0000 |
commit | 24ed49a2547349634cc8fa2f0f65f52bfc7c3d63 (patch) | |
tree | 3182cc0dfe11702c7438ba147e35196d9ccbd70d | |
parent | 264f2265884b3d50103a5315c6bd46df3be04451 (diff) |
tdf#104162 DOCX import: fix crash on <w:hideMark/> in a comment table
sw comments are handled by editeng, so tables in comments aren't
imported. That means lcl_emptyRow() may get a row where the first cell's
start is an empty reference, so handle that case.
(cherry picked from commit 74dddd8b483d89dc7915471441cc30a1aa342363)
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
Change-Id: I43e286314143934c20e6cbbd656d32883b6b2efe
Reviewed-on: https://gerrit.libreoffice.org/32223
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Reviewed-on: https://gerrit.libreoffice.org/33925
Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf104162.docx | bin | 0 -> 14541 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport7.cxx | 8 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 8 |
3 files changed, 16 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf104162.docx b/sw/qa/extras/ooxmlexport/data/tdf104162.docx Binary files differnew file mode 100644 index 000000000000..61b51c007713 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf104162.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx index 3537092a58bc..62af2714b9d7 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx @@ -1194,6 +1194,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103544, "tdf103544.docx") CPPUNIT_ASSERT(xGraphic.is()); } +DECLARE_OOXMLEXPORT_TEST(testTdf104162, "tdf104162.docx") +{ + // This crashed: the comment field contained a table with a <w:hideMark/>. + uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XElementAccess> xTextFields(xTextFieldsSupplier->getTextFields()); + CPPUNIT_ASSERT(xTextFields->hasElements()); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 43ef3be6ed3e..a2e0495d97ff 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -883,6 +883,14 @@ bool lcl_emptyRow(std::vector<RowSequence_t>& rTableRanges, sal_Int32 nRow) return false; } + if (!rRowSeq[0][0].is()) + { + // This can happen when we can't import the table, e.g. we're inside a + // comment. + SAL_WARN("writerfilter.dmapper", "rRowSeq[0][0] is an empty reference"); + return false; + } + uno::Reference<text::XTextRangeCompare> xTextRangeCompare(rRowSeq[0][0]->getText(), uno::UNO_QUERY); try { |