writerfilter/source/rtftok/rtfdocumentimpl.cxx |    1 +
 1 file changed, 1 insertion(+)

New commits:
commit 6446d3e12440be39e6b55f8749038061a1b240da
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Wed Feb 7 13:04:14 2024 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Thu Feb 8 13:00:25 2024 +0100

    tdf#158586 writerfilter: RTF import: fix assert on ooo113308-1.rtf
    
      warn:legacy.osl:::writerfilter/source/dmapper/DomainMapper_Impl.cxx:1278: 
section stack already empty
      DomainMapper_Impl.cxx:9817: void 
writerfilter::dmapper::DomainMapper_Impl::substream(): Assertion 
`m_aContextStack.size() == contextSize' failed.
    
    Before substream(), there is one CONTEXT_SECTION, after there is an
    additional CONTEXT_PARAGRPAH.
    
    The first OSL_ENSURE is because RTFDocumentImpl::tableBreak() calls
    endParagraphGroup() but in the substream, startParagraphGroup() hadn't
    been called; fixing this also makes the assert failure go away.
    
    This worked previously because sectBreak() called endParagraphGroup()
    after reading the header substreams, but it seems dubious that a
    paragraph group started in the body should be used in the substream.
    
    (regression from commit 57abad5cf990111fd7de011809d4421dc0550193)
    
    Change-Id: I98864bca03b59099c17080c0a7582de2b77d41e1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163096
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 0853cfa1b600..4db4a6352cce 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -654,6 +654,7 @@ void RTFDocumentImpl::runBreak()
 
 void RTFDocumentImpl::tableBreak()
 {
+    checkFirstRun(); // ooo113308-1.rtf has a header at offset 151084 that 
doesn't startParagraphGroup() without this
     runBreak();
     Mapper().endParagraphGroup();
     Mapper().startParagraphGroup();

Reply via email to