summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2013-10-16 16:47:38 +0100
committerEike Rathke <erack@redhat.com>2013-10-29 12:08:33 +0000
commite09cdbcf83cb71de5f59f4609b244b104a584089 (patch)
tree84e4ef50e5a1cd58a9f5d11fbe24abb0327d0984
parent9404457a19178b42ea40ebd710725520a83c85ef (diff)
i123485 secured file import scanning existing pages
(cherry picked from commit 04b38114b0ca4be9895d8f9fa842b6cb390c8036 and adapted to the rewritten scanBuildPageChainCache) Reviewed-on: https://gerrit.libreoffice.org/6272 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com> (cherry picked from commit dfa1afd0e8b7ae9c706c4a3171a04752e24230b0) Conflicts: sot/source/sdstor/stgstrms.cxx Change-Id: Ib90d0563be5aeb69aa14c28b3304e42f3cc46162 Reviewed-on: https://gerrit.libreoffice.org/6375 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
-rw-r--r--sot/source/sdstor/stgstrms.cxx15
1 files changed, 11 insertions, 4 deletions
diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index b2c94ef3b0e2..dae953f25bcb 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -23,6 +23,7 @@
#include <sal/log.hxx>
#include <osl/file.hxx>
#include <tools/tempfile.hxx>
+#include <set>
#include "sot/stg.hxx"
#include "stgelem.hxx"
@@ -341,16 +342,22 @@ void StgStrm::scanBuildPageChainCache(sal_Int32 *pOptionalCalcSize)
bool bError = false;
sal_Int32 nBgn = nStart;
- sal_Int32 nOldBgn = -1;
sal_Int32 nOptSize = 0;
- while( nBgn >= 0 && nBgn != nOldBgn )
+
+ // Track already scanned PageNumbers here and use them to
+ // see if an already counted page is re-visited
+ std::set< sal_Int32 > nUsedPageNumbers;
+
+ while( nBgn >= 0 && !bError )
{
if( nBgn >= 0 )
m_aPagesCache.push_back(nBgn);
- nOldBgn = nBgn;
nBgn = pFat->GetNextPage( nBgn );
- if( nBgn == nOldBgn )
+
+ //returned second is false if it already exists
+ if (!nUsedPageNumbers.insert(nBgn).second)
bError = true;
+
nOptSize += nPageSize;
}
if (bError)