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 57abad5cf9)

Change-Id: I98864bca03b59099c17080c0a7582de2b77d41e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163096
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
This commit is contained in:
Michael Stahl 2024-02-07 13:04:14 +01:00
parent 181f4c5ac9
commit 6446d3e124

View file

@ -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();