sw/qa/extras/ooxmlexport/data/tdf153891.docx             |binary
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx                |    5 +++++
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |    4 +++-
 3 files changed, 8 insertions(+), 1 deletion(-)

New commits:
commit e34074feeb1b918ab9f26a18c5fdb0b1f2e35f94
Author:     László Németh <nem...@numbertext.org>
AuthorDate: Wed Mar 1 14:11:30 2023 +0100
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Thu Mar 2 21:51:39 2023 +0000

    tdf#153891 DOCX import: crash fix at missing cell properties
    
    Regression from commit 81ce88aa80f8e7cde4fdc5b211e9500a3599643c
    "tdf#132514 DOCX import: fix lost table style with footer".
    
    Note: no crash without this fix by removing styles.xml from
    the test document.
    
    Change-Id: I7fd7edfc8f62e6b17c0c8f7a3bdec7d986ba57eb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148053
    Tested-by: Jenkins
    Reviewed-by: László Németh <nem...@numbertext.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf153891.docx 
b/sw/qa/extras/ooxmlexport/data/tdf153891.docx
new file mode 100644
index 000000000000..6fe8092982b6
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf153891.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
index f80526a74e9b..213b8842f866 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
@@ -518,6 +518,11 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf132514)
     assertXPath(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[2]/w:p[2]/w:pPr/w:spacing", "after", 
"0");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf153891, "tdf153891.docx")
+{
+    // This document simply crashed the importer.
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testFdo69636)
 {
     loadAndSave("fdo69636.docx");
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index fc19793991f8..c879091f01ca 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -1445,7 +1445,9 @@ void DomainMapperTableHandler::endTable(unsigned int 
nestedTableLevel, bool bTab
                             if (bApply)
                             {
                                 bool bEndOfApply = 
(xTextRangeCompare->compareRegionEnds(rEndPara, aIt->m_rEndParagraph) == 0);
-                                ApplyParagraphPropertiesFromTableStyle(*aIt, 
aAllTableParaProperties, aCellProperties[nRow][nCell]);
+                                // tdf#153891 handle missing cell properties 
(exception in style handling?)
+                                if ( nCell < 
sal::static_int_cast<std::size_t>(aCellProperties[nRow].getLength()) )
+                                    
ApplyParagraphPropertiesFromTableStyle(*aIt, aAllTableParaProperties, 
aCellProperties[nRow][nCell]);
                                 // erase processed paragraph from list of 
pending paragraphs
                                 aIt = pTableParagraphs->erase(aIt);
                                 if (bEndOfApply)

Reply via email to