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

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Thu Jan 30 15:56:03 UTC 2020


 sw/qa/extras/ooxmlimport/data/tdf129659.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx    |    5 +++++
 writerfilter/source/dmapper/DomainMapper.cxx |   15 +++++++--------
 3 files changed, 12 insertions(+), 8 deletions(-)

New commits:
commit a0db764766dffe868ba3075901326ed6410ea037
Author:     Jan-Marek Glogowski <jan-marek.glogowski at extern.cib.de>
AuthorDate: Mon Jan 20 22:49:31 2020 +0100
Commit:     Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Thu Jan 30 16:55:34 2020 +0100

    tdf#129659 DOCX check global footnote context
    
    Since tdf#121441 we parse custom footnotes to get at least the
    DOCX footnote text, even if we can't represent the formating. This
    might push additional contexts to the parser stack. Therefore it's
    now not sufficient to check the current context for a footnote,
    but one has to check the global parser for a footnote context.
    
    The actual bug is the unsupported footnote page break, which was
    not correctly ignored and added a paragraph context to the stack,
    resulting in the async substream input and output stack size.
    
    Change-Id: I143254e7df37a619cb4efb542b58d3eff3afffa7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87114
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
    (cherry picked from commit b87af9775167002d36a3bc16cb308ea7895d7ea0)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87742
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/sw/qa/extras/ooxmlimport/data/tdf129659.docx b/sw/qa/extras/ooxmlimport/data/tdf129659.docx
new file mode 100644
index 000000000000..38bd040d59bd
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf129659.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 636e0337ad81..29a1e4e0dcf0 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -536,6 +536,11 @@ DECLARE_OOXMLIMPORT_TEST(testTdf130214, "tdf130214.docx")
     // Currently this file imports with errors because of tdf#126435; it must not segfault on load
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf129659, "tdf129659.docx")
+{
+    // don't crash on footnote with page break
+}
+
 // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index f7f24546def8..4ea227cd8e0e 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3174,8 +3174,7 @@ void DomainMapper::lcl_text(const sal_uInt8 * data_, size_t len)
             }
         }
 
-        PropertyMapPtr pContext = m_pImpl->GetTopContext();
-        if (pContext && !pContext->GetFootnote().is())
+        if (!m_pImpl->GetFootnoteContext())
         {
             if (m_pImpl->isBreakDeferred(PAGE_BREAK))
                 m_pImpl->GetTopContext()->Insert(PROP_BREAK_TYPE, uno::makeAny(style::BreakType_PAGE_BEFORE));
@@ -3184,7 +3183,8 @@ void DomainMapper::lcl_text(const sal_uInt8 * data_, size_t len)
             m_pImpl->clearDeferredBreaks();
         }
 
-        if( pContext->GetFootnote().is() && m_pImpl->IsInCustomFootnote() )
+        PropertyMapPtr pContext = m_pImpl->GetTopContext();
+        if (pContext && pContext->GetFootnote().is() && m_pImpl->IsInCustomFootnote())
         {
             pContext->GetFootnote()->setLabel(sText);
             //otherwise ignore sText
@@ -3410,7 +3410,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
             const bool bSingleParagraph = m_pImpl->GetIsFirstParagraphInSection() && m_pImpl->GetIsLastParagraphInSection();
             const bool bSingleParagraphAfterRedline = m_pImpl->GetIsFirstParagraphInSection(true) && m_pImpl->GetIsLastParagraphInSection();
             PropertyMapPtr pContext = m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH);
-            if (pContext && !pContext->GetFootnote().is())
+            if (!m_pImpl->GetFootnoteContext())
             {
                 if (m_pImpl->isBreakDeferred(PAGE_BREAK))
                 {
@@ -3470,9 +3470,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
         }
         else
         {
-
-            PropertyMapPtr pContext = m_pImpl->GetTopContext();
-            if ( pContext && !pContext->GetFootnote().is() )
+            if (!m_pImpl->GetFootnoteContext())
             {
                 if (m_pImpl->isBreakDeferred(PAGE_BREAK))
                 {
@@ -3501,7 +3499,8 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
                 m_pImpl->clearDeferredBreaks();
             }
 
-            if( pContext && pContext->GetFootnote().is() )
+            PropertyMapPtr pContext = m_pImpl->GetTopContext();
+            if (pContext && pContext->GetFootnote().is() && m_pImpl->IsInCustomFootnote())
             {
                 pContext->GetFootnote()->setLabel( sText );
                 //otherwise ignore sText


More information about the Libreoffice-commits mailing list