From 7c4dba1deffd81f647a4a3be7a79f68f3bf9f1ba Mon Sep 17 00:00:00 2001 From: Jaume Pujantell Date: Wed, 22 Nov 2023 11:59:09 +0100 Subject: [PATCH] fix a regression crash from commit 5082d50 The commit generated crashes in the crashtest documents 7711 bugtrackers/docx/fdo78333-1.docx and 695 forums/docx/forum-mso-en-4096.docx. This was due to "m_xFieldStartRange", the start of the text portion of the block SDT, being recorded too early. This led to including characters that shouldn't be there in the generated content control. This patch moves the calls to setFieldStartRange to just before the first appendTextPortion call. Change-Id: I7230346fee9a37ebac70beb9bcafd9d7b612eb00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159816 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- .../qa/cppunittests/dmapper/DomainMapper.cxx | 6 ++++ .../dmapper/data/fdo78333-1-minimized.docx | Bin 0 -> 27391 bytes writerfilter/source/dmapper/DomainMapper.cxx | 26 ++++++------------ writerfilter/source/dmapper/SdtHelper.cxx | 1 + 4 files changed, 16 insertions(+), 17 deletions(-) create mode 100644 writerfilter/qa/cppunittests/dmapper/data/fdo78333-1-minimized.docx diff --git a/writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx b/writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx index 7cafcd19f280..ec771ba0f1b4 100644 --- a/writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx +++ b/writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx @@ -149,6 +149,12 @@ CPPUNIT_TEST_FIXTURE(Test, testSdtBlockText) xContentControlProps->getPropertyValue("Alias") >>= aAlias; CPPUNIT_ASSERT_EQUAL(OUString("myalias"), aAlias); } + +CPPUNIT_TEST_FIXTURE(Test, testFdo78333) +{ + // just care that it doesn't crash/assert + loadFromURL(u"fdo78333-1-minimized.docx"); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/qa/cppunittests/dmapper/data/fdo78333-1-minimized.docx b/writerfilter/qa/cppunittests/dmapper/data/fdo78333-1-minimized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Pp~_Op65yFAS7Jve(`{N zrYYxl8S#mSzPB7cy1S0Xsf*sgFlP4I25?vSq*YlV*XebO{WM3}M-%I{#X3i_*9UG)>XSElt+K7Z9c5HNStdY zj?(3k`^9NDKsqH2MAYq8*)`QG9LT+!JB7YO@YnjQu^x~q^rX^o*5l0=O+((q0^CHA zhnsB?)F{XEw^-+L5WVpetsf` ztHL0z_OOfBiwm7*HtBQneNPIdXdQVaQJV3@B&3b{)q&=p+tv!`9XDt~Z@($DfC5Ez zSZWH*vWtQ8IE2Uovanv?u7S{DAG$jkF-AKGaqH*T#oXV2kVH7#K`+e_;b0EWvndA; z;yhK0XHM)F=T@gR%5<#Wv!tHTdj*=hXn!ytSB&EC>w$wOf6c$d%MqFD+(_<>fU_zZ z=!A`hSXg;wOczXtjZ(oc}*VhlbpwxyyEsY-@WXQ^XSR{Kg&cv=iv zcj-6f1XO9m_H|0)9v8*E@^%sdz1@x+xZ zs_8z{{Zu=@xO9krGX0i#=RW>^=8|7{S+bw_yLn9R!|$hp_yy;q{0YCG7~(#~{ea+K z6t46?Dei^`--rJmhxH2#1@-(H)SsfV?i2hT*L0WQ8S8z5Ur|o?S$+@cxy$0ocAw=( z({!KU_kfwZ1p4gv34T=Lk1Y2iM}F~SaQr-(zr~TzMK>7Sy@G%0sodxK{RwxM3uN?Xu3yhPc_|o38}!|JhXF+e$^Q1vPushSdt(); break; } - if (m_pImpl->m_pSdtHelper->getControlType() == SdtControlType::plainText - && GetCurrentTextRange().is()) - m_pImpl->m_pSdtHelper->setFieldStartRange(GetCurrentTextRange()->getEnd()); m_pImpl->SetSdt(true); } break; @@ -4229,7 +4226,6 @@ void DomainMapper::lcl_utext(const sal_Unicode *const data_, size_t len) { m_pImpl->m_pSdtHelper->createPlainTextControl(); finishParagraph(); - m_pImpl->m_pSdtHelper->setFieldStartRange(GetCurrentTextRange()->getEnd()); return; } } @@ -4487,10 +4483,9 @@ void DomainMapper::lcl_utext(const sal_Unicode *const data_, size_t len) m_pImpl->clearDeferredBreaks(); } - bool bSdtBlockUnusedText - = m_pImpl->m_pSdtHelper->GetSdtType() != NS_ooxml::LN_CT_SdtRun_sdtContent - && m_pImpl->m_pSdtHelper->getControlType() == SdtControlType::plainText - && m_pImpl->m_pSdtHelper->hasUnusedText(); + bool bInSdtBlockText + = m_pImpl->m_pSdtHelper->GetSdtType() == NS_ooxml::LN_CT_SdtBlock_sdtContent + && m_pImpl->m_pSdtHelper->getControlType() == SdtControlType::plainText; if (pContext && pContext->GetFootnote().is()) { pContext->GetFootnote()->setLabel( sText ); @@ -4500,32 +4495,29 @@ void DomainMapper::lcl_utext(const sal_Unicode *const data_, size_t len) } else if (m_pImpl->IsOpenFieldCommand() && !m_pImpl->IsForceGenericFields()) { - if (bSdtBlockUnusedText) + if (bInSdtBlockText && m_pImpl->m_pSdtHelper->hasUnusedText()) m_pImpl->m_pSdtHelper->createPlainTextControl(); m_pImpl->AppendFieldCommand(sText); - if (bSdtBlockUnusedText) - m_pImpl->m_pSdtHelper->setFieldStartRange(GetCurrentTextRange()->getEnd()); } else if( m_pImpl->IsOpenField() && m_pImpl->IsFieldResultAsString()) { - if (bSdtBlockUnusedText) + if (bInSdtBlockText && m_pImpl->m_pSdtHelper->hasUnusedText()) m_pImpl->m_pSdtHelper->createPlainTextControl(); /*depending on the success of the field insert operation this result will be set at the field or directly inserted into the text*/ m_pImpl->AppendFieldResult(sText); - if (bSdtBlockUnusedText) - m_pImpl->m_pSdtHelper->setFieldStartRange(GetCurrentTextRange()->getEnd()); } else { if (pContext == nullptr) pContext = new PropertyMap(); + if (bInSdtBlockText && !m_pImpl->m_pSdtHelper->hasUnusedText()) + m_pImpl->m_pSdtHelper->setFieldStartRange(GetCurrentTextRange()->getEnd()); + m_pImpl->appendTextPortion( sText, pContext ); - if (m_pImpl->m_pSdtHelper->GetSdtType() == NS_ooxml::LN_CT_SdtBlock_sdtContent - && m_pImpl->m_pSdtHelper->getControlType() == SdtControlType::plainText - && !sText.isEmpty()) + if (bInSdtBlockText && !sText.isEmpty()) m_pImpl->m_pSdtHelper->setHasUnusedText(true); } diff --git a/writerfilter/source/dmapper/SdtHelper.cxx b/writerfilter/source/dmapper/SdtHelper.cxx index c7f99878e12d..922ac5bea106 100644 --- a/writerfilter/source/dmapper/SdtHelper.cxx +++ b/writerfilter/source/dmapper/SdtHelper.cxx @@ -604,6 +604,7 @@ void SdtHelper::clear() m_nId = 0; m_nTabIndex = 0; m_aLock.clear(); + m_xFieldStartRange.clear(); } void SdtHelper::SetPlaceholderDocPart(const OUString& rPlaceholderDocPart)