[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sw/qa writerfilter/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Tue Feb 4 10:01:56 UTC 2020


 sw/qa/extras/ooxmlimport/data/tdf130214.docx      |binary
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx         |    5 +++++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    6 ++++++
 3 files changed, 11 insertions(+)

New commits:
commit 8289795cfe2cbc22571be6408ec0018808b18213
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Tue Jan 28 13:22:56 2020 +0300
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Feb 4 11:01:14 2020 +0100

    tdf#130214: workaround invalid state resulting from error on import
    
    Obviously the real error is somewhere else, which results in tdf#126435,
    and produces unexpected state with missing text append context on stack.
    This is just a hack to avoid crash.
    
    Change-Id: I420ac3b74f5efb9688dc764ac2ad0dcc974ba0e1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87595
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Tested-by: Mike Kaganski <mike.kaganski at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87952
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sw/qa/extras/ooxmlimport/data/tdf130214.docx b/sw/qa/extras/ooxmlimport/data/tdf130214.docx
new file mode 100644
index 000000000000..4344e1c6e44e
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf130214.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 31e40b3d062e..110231888dee 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -439,6 +439,11 @@ DECLARE_OOXMLIMPORT_TEST(testTdf126114, "tdf126114.docx")
     CPPUNIT_ASSERT_EQUAL(7, getLength());
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf130214, "tdf130214.docx")
+{
+    // Currently this file imports with errors because of tdf#126435; it must not segfault on load
+}
+
 // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 04432a9cb63e..81f518af9c29 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4138,6 +4138,12 @@ void DomainMapper_Impl::handleBibliography
     (const FieldContextPtr& pContext,
     const OUString & sTOCServiceName)
 {
+    if (m_aTextAppendStack.empty())
+    {
+        // tdf#130214: a workaround to avoid crash on import errors
+        SAL_WARN("writerfilter.dmapper", "no text append stack");
+        return;
+    }
     // Create section before setting m_bStartTOC and m_bStartBibliography: finishing paragraph
     // inside StartIndexSectionChecked could do the wrong thing otherwise
     const auto xTOC = StartIndexSectionChecked(sTOCServiceName);


More information about the Libreoffice-commits mailing list