diff options
author | Rüdiger Timm <rt@openoffice.org> | 2008-07-08 07:28:23 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2008-07-08 07:28:23 +0000 |
commit | de907deeac388b31e5953d472d3dc8d3877c60c6 (patch) | |
tree | 11f5eadaacc542e18f1fd5c47b0920e4540051f3 /package | |
parent | a63d60945b60581152c1c8bf8dedf548ed20e7c9 (diff) |
INTEGRATION: CWS fwk90 (1.48.12); FILE MERGED
2008/06/08 15:23:26 mav 1.48.12.1: #i88946# fix reparing of encrypted documents
Diffstat (limited to 'package')
-rw-r--r-- | package/source/zipapi/ZipFile.cxx | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index a2873ff5cf8d..17c06512c42c 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ZipFile.cxx,v $ - * $Revision: 1.49 $ + * $Revision: 1.50 $ * * This file is part of OpenOffice.org. * @@ -876,14 +876,24 @@ sal_Int32 ZipFile::recover() for( EntryHash::iterator aIter = aEntries.begin(); aIter != aEntries.end(); aIter++ ) { ZipEntry aTmp = (*aIter).second; - if( (*aIter).second.nMethod == DEFLATED && (*aIter).second.nFlag & 8 ) + + // this is a broken package, accept this block not only for DEFLATED streams + if( (*aIter).second.nFlag & 8 ) { sal_Int32 nStreamOffset = nGenPos + nPos - nCompressedSize; if ( nStreamOffset == (*aIter).second.nOffset && nCompressedSize > (*aIter).second.nCompressedSize ) { - sal_Int32 nRealSize = 0, nRealCRC = 0; - getSizeAndCRC( nStreamOffset, nCompressedSize, &nRealSize, &nRealCRC ); - if ( nRealSize == nSize && nRealCRC == nCRC32 ) + // only DEFLATED blocks need to be checked + sal_Bool bAcceptBlock = ( (*aIter).second.nMethod == STORED && nCompressedSize == nSize ); + + if ( !bAcceptBlock ) + { + sal_Int32 nRealSize = 0, nRealCRC = 0; + getSizeAndCRC( nStreamOffset, nCompressedSize, &nRealSize, &nRealCRC ); + bAcceptBlock = ( nRealSize == nSize && nRealCRC == nCRC32 ); + } + + if ( bAcceptBlock ) { (*aIter).second.nCrc = nCRC32; (*aIter).second.nCompressedSize = nCompressedSize; |