sw/qa/core/data/ww8/pass/ofz19065.doc |binary
 sw/source/core/doc/docbm.cxx          |    9 +++++++++
 sw/source/filter/ww8/ww8par5.cxx      |    6 ------
 3 files changed, 9 insertions(+), 6 deletions(-)

New commits:
commit 85d1228bab3d5ef73b0de42dc11267d8bf38e127
Author:     Michael Stahl <[email protected]>
AuthorDate: Mon Nov 25 15:51:24 2019 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Tue Nov 26 11:08:23 2019 +0100

    ofz#19065 sw: invalid fieldmarks created in SwWW8ImplReader::End_Field
    
    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/83729
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>
    Tested-by: Caolán McNamara <[email protected]>

diff --git a/sw/qa/core/data/ww8/pass/ofz19065.doc 
b/sw/qa/core/data/ww8/pass/ofz19065.doc
new file mode 100644
index 000000000000..a242f13bf8e6
Binary files /dev/null and b/sw/qa/core/data/ww8/pass/ofz19065.doc differ
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index c0c973904bf5..bab44aa4a5f5 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -583,6 +583,15 @@ namespace sw { namespace mark
         }
 
         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
             && sw::mark::IsFieldmarkOverlap(rPaM))
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 39e13b8cac5d..e6f31bb0736a 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -533,12 +533,6 @@ sal_uInt16 SwWW8ImplReader::End_Field()
         case ww::eFORMTEXT:
         if (bUseEnhFields && m_pPaM!=nullptr && m_pPaM->GetPoint()!=nullptr) {
             SwPosition aEndPos = *m_pPaM->GetPoint();
-            if (!::CheckNodesRange(m_aFieldStack.back().GetPtNode(),
-                        aEndPos.nNode, true))
-            {   // example ofz7322-1.doc
-                SAL_INFO("sw.ww8", "skipping field with invalid node range");
-                break;
-            }
             SwPaM aFieldPam( m_aFieldStack.back().GetPtNode(), 
m_aFieldStack.back().GetPtContent(), aEndPos.nNode, 
aEndPos.nContent.GetIndex());
             IDocumentMarkAccess* pMarksAccess = m_rDoc.getIDocumentMarkAccess( 
);
             IFieldmark *pFieldmark = pMarksAccess->makeFieldBookmark(
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to