[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Tue Dec 20 13:09:54 UTC 2016


 sw/qa/extras/ooxmlexport/data/tdf104162.docx             |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx                |    8 ++++++++
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |    8 ++++++++
 3 files changed, 16 insertions(+)

New commits:
commit e4be3c9810ecbf2733f7e5884dbba19c426749ef
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Dec 19 19:35:20 2016 +0100

    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 at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf104162.docx b/sw/qa/extras/ooxmlexport/data/tdf104162.docx
new file mode 100644
index 0000000..61b51c0
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf104162.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 5487a07..8bf2b5b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -176,6 +176,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103651, "tdf103651.docx")
     CPPUNIT_ASSERT_EQUAL( sal_Int32( -1 ) , sContent.indexOf( sal_Unicode( 0xf04a ) ));
 }
 
+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());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 0b89aa1..3af9e3b 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -896,6 +896,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
     {


More information about the Libreoffice-commits mailing list