summaryrefslogtreecommitdiff
path: root/sot
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2013-10-16 16:47:38 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2013-10-24 07:27:15 +0000
commitf35096b7f7f3ad168cd221a20823e25a56315948 (patch)
treec9940a920117e6518d5193b83055914f705d9d9e /sot
parenta41deebce26dfa6b2d6d77b63bdb9d2965003678 (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/6314 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sot')
-rw-r--r--sot/source/sdstor/stgstrms.cxx16
1 files changed, 12 insertions, 4 deletions
diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index 1561204e1e3e..1c9af60081af 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"
@@ -339,16 +340,23 @@ 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 )
+
+ if( nUsedPageNumbers.find(nBgn) != nUsedPageNumbers.end() )
bError = true;
+ else
+ nUsedPageNumbers.insert(nBgn);
+
nOptSize += nPageSize;
}
if (bError)