Kaydet (Commit) 5175e38d authored tarafından Serge Krot's avatar Serge Krot Kaydeden (comit) Thorsten Behrens

Fix: nNodeCnt could be set to negative value

Change-Id: I82e9b150e97e733c4063f7498dc026e0c9f903c0
Reviewed-on: https://gerrit.libreoffice.org/53660Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
Tested-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
Reviewed-on: https://gerrit.libreoffice.org/53667Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst d57033dd
......@@ -1732,7 +1732,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 )
{
pCurrentNode = &aRg.aStart.GetNode();
......@@ -1744,7 +1744,7 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange,
pDoc->GetNodes().GetEndOfInserts().StartOfSectionIndex()
< aInsPos.GetIndex() )
{
sal_uLong nDistance =
const long nDistance =
( pCurrentNode->EndOfSectionIndex() -
aRg.aStart.GetIndex() );
if (nDistance < nNodeCnt)
......@@ -1785,7 +1785,7 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange,
SwNodeIndex nStt( aInsPos, -1 );
SwTableNode* pTableNd = static_cast<SwTableNode*>(pCurrentNode)->
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
......@@ -1813,7 +1813,7 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange,
SwSectionNode* pSectNd = static_cast<SwSectionNode*>(pCurrentNode)->
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment