diff options
author | Armin Le Grand <alg@apache.org> | 2013-10-16 16:47:38 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2013-11-05 12:08:33 +0100 |
commit | f6d5a0e7bbd54c7a6c09eea9d1fa7f1f04020664 (patch) | |
tree | b619069d1de7d0f21d3de2d3161c44b7718f68d7 | |
parent | ce7a630b074d63cb408f2c61f96e63c10b97bb61 (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.cxx | 15 |
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) |