[Libreoffice-commits] core.git: 2 commits - sw/source writerfilter/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Tue Oct 29 15:32:53 UTC 2019


 sw/source/core/doc/docbm.cxx                      |   12 ++++++++++++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    8 ++++++++
 2 files changed, 20 insertions(+)

New commits:
commit e4ea1d08296755cb765e699325b895cac448e0df
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Oct 29 13:58:13 2019 +0100
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Tue Oct 29 16:31:49 2019 +0100

    sw: makeMark(): check position of point fieldmarks
    
    A new point fieldmark must have an empty range, which is expanded when
    the CH_TXT_ATR_FORMELEMENT is inserted.
    
    A copied point fieldmark must contain exactly its
    CH_TXT_ATR_FORMELEMENT.
    
    Change-Id: Iaf3cdad058539300199fe159d215b7aa37dae35d
    Reviewed-on: https://gerrit.libreoffice.org/81672
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 68914f38c0b3..b3d0470a3124 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -581,6 +581,18 @@ namespace sw { namespace mark
             return nullptr;
         }
 
+        if ((eType == MarkType::CHECKBOX_FIELDMARK || eType == MarkType::DROPDOWN_FIELDMARK)
+            && (eMode == InsertMode::New
+                ? *rPaM.GetPoint() != *rPaM.GetMark()
+                // CopyText: pam covers CH_TXT_ATR_FORMELEMENT
+                : (rPaM.GetPoint()->nNode != rPaM.GetMark()->nNode
+                    || rPaM.Start()->nContent.GetIndex() + 1 != rPaM.End()->nContent.GetIndex())))
+        {
+            SAL_WARN("sw.core", "MarkManager::makeMark(..)"
+                " - invalid range on point fieldmark");
+            return nullptr;
+        }
+
         // create mark
         std::unique_ptr<::sw::mark::MarkBase> pMark;
         switch(eType)
commit b2fe67eb74cfa124d654815eb7897380602a2b66
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Oct 29 13:56:50 2019 +0100
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Tue Oct 29 16:31:30 2019 +0100

    writerfilter: assert that start position is before end position
    
    As seen in fdo34663-1.docx; should find more bugs hopefully.
    
    Change-Id: Id38fdebe3ab4f48af298e2ef76ad66051cee5bcf
    Reviewed-on: https://gerrit.libreoffice.org/81671
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 3ce2f1a37d04..276f408451f3 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4352,6 +4352,14 @@ static auto InsertFieldmark(std::stack<TextAppendContext> & rTextAppendStack,
         xTextAppend->createTextCursorByRange(xStartRange);
     if (rTextAppendStack.top().xInsertPosition.is())
     {
+        uno::Reference<text::XTextRangeCompare> const xCompare(
+                rTextAppendStack.top().xTextAppend,
+                uno::UNO_QUERY);
+        if (xCompare->compareRegionStarts(xStartRange, rTextAppendStack.top().xInsertPosition) < 0)
+        {
+            SAL_WARN("writerfilter.dmapper", "invalid field mark positions");
+            assert(false);
+        }
         xCursor->gotoRange(rTextAppendStack.top().xInsertPosition, true);
     }
     else


More information about the Libreoffice-commits mailing list