From fbb3514aee8261211790b23586752d5be9ac2f34 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 25 Nov 2019 15:51:24 +0100 Subject: ofz#19065 sw: invalid fieldmarks created in SwWW8ImplReader::End_Field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The problem is that the check added in commit 06767a5394f1dfba71c4f0a2a07daa5664bdbd01 "sw: WW8: do not create fieldmark with start in frame and end in body" doesn't work as well as imagined; the CheckNodesRange will only check against mismatching top-level and second-level (in the non-body-text top-levels) sections, whereas in this case the start is in one table cell and the end in the next one. So replace that and move the check into MarkManager::makeMark(), so other things than WW8 import are also checked. Change-Id: I2bf32e7b579d87600b6b6718a3222f37c14aa53d Reviewed-on: https://gerrit.libreoffice.org/83585 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sw/source/core/doc/docbm.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'sw/source/core/doc/docbm.cxx') diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index dec1b3d58654..f736348480a5 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -582,6 +582,15 @@ namespace sw { namespace mark return nullptr; } + if ((eType == MarkType::TEXT_FIELDMARK || eType == MarkType::DATE_FIELDMARK) + && (rPaM.GetPoint()->nNode.GetNode().StartOfSectionNode() != rPaM.GetMark()->nNode.GetNode().StartOfSectionNode() + || (pSepPos && rPaM.GetPoint()->nNode.GetNode().StartOfSectionNode() != pSepPos->nNode.GetNode().StartOfSectionNode()))) + { + SAL_WARN("sw.core", "MarkManager::makeMark(..)" + " - invalid range on fieldmark, different nodes array sections"); + return nullptr; + } + if ((eType == MarkType::TEXT_FIELDMARK || eType == MarkType::DATE_FIELDMARK) // can't check for Copy - it asserts - but it's also obviously unnecessary && eMode == InsertMode::New -- cgit