[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - sw/source

Serge Krot Serge.Krot at cib.de
Mon Apr 30 13:46:09 UTC 2018


 sw/source/core/docnode/nodes.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 29f178a8c3c053d8ba85a7cd162888b8db2ad9d0
Author: Serge Krot <Serge.Krot at cib.de>
Date:   Mon Apr 30 13:59:34 2018 +0200

    Fix: nNodeCnt could be set to negative value
    
    Change-Id: I82e9b150e97e733c4063f7498dc026e0c9f903c0
    Reviewed-on: https://gerrit.libreoffice.org/53660
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 0bc9904fbe0c..588784d99871 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -1736,7 +1736,7 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange,
     SwNodeIndex aOrigInsPos( rIndex, -1 ); // original insertion position
     int nLevel = 0;                        // level counter
 
-    for( sal_uLong nNodeCnt = aRg.aEnd.GetIndex() - aRg.aStart.GetIndex();
+    for( long nNodeCnt = aRg.aEnd.GetIndex() - aRg.aStart.GetIndex();
             nNodeCnt > 0; --nNodeCnt )
     {
         pAktNode = &aRg.aStart.GetNode();
@@ -1748,7 +1748,7 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange,
                     pDoc->GetNodes().GetEndOfInserts().StartOfSectionIndex()
                     < aInsPos.GetIndex() )
             {
-                sal_uLong nDistance =
+                const long nDistance =
                     ( pAktNode->EndOfSectionIndex() -
                         aRg.aStart.GetIndex() );
                 if (nDistance < nNodeCnt)
@@ -1789,7 +1789,7 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange,
                 SwNodeIndex nStt( aInsPos, -1 );
                 SwTableNode* pTableNd = static_cast<SwTableNode*>(pAktNode)->
                                         MakeCopy( pDoc, aInsPos );
-                sal_uLong nDistance = aInsPos.GetIndex() - nStt.GetIndex() - 2;
+                const long nDistance = aInsPos.GetIndex() - nStt.GetIndex() - 2;
                 if (nDistance < nNodeCnt)
                     nNodeCnt -= nDistance;
                 else
@@ -1817,7 +1817,7 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange,
                 SwSectionNode* pSectNd = static_cast<SwSectionNode*>(pAktNode)->
                                     MakeCopy( pDoc, aInsPos );
 
-                sal_uLong nDistance = aInsPos.GetIndex() - nStt.GetIndex() - 2;
+                const long nDistance = aInsPos.GetIndex() - nStt.GetIndex() - 2;
                 if (nDistance < nNodeCnt)
                     nNodeCnt -= nDistance;
                 else


More information about the Libreoffice-commits mailing list