summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2020-01-28 13:22:56 +0300
committerMiklos Vajna <vmiklos@collabora.com>2020-02-10 12:22:29 +0100
commitcbd9c059ea7a865604e2a631ddc1eb88395633c1 (patch)
treeebc9ad7f45abdb1ba086b015c16ff026a6a6c192
parent1253f7e8fa405ee39bb72dc24d02a09dc757aa58 (diff)
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@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit eca00082c78fddf79f247057227404738be8806c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87635 Tested-by: Jenkins Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org> (cherry picked from commit d7d27ce1788fa6dab98639626fd3b856c0ae6b37) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87666 Reviewed-by: Michael Stahl <michael.stahl@cib.de> Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--sw/qa/extras/ooxmlimport/data/tdf130214.docxbin0 -> 23057 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport2.cxx5
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx6
3 files changed, 11 insertions, 0 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/tdf130214.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 2a250a898cf2..28d62e4811db 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -460,6 +460,11 @@ DECLARE_OOXMLIMPORT_TEST(testTdf103345, "numbering-circle.docx")
}
}
+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 15c6ae130ecd..d4e97d18f598 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4221,6 +4221,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);