From 309f56174aca6adca879f70958892492361dac6e Mon Sep 17 00:00:00 2001 From: Thorsten Behrens Date: Wed, 14 Dec 2011 13:30:34 +0100 Subject: Fix n#653688 Seems our Zip package is a bit too strict in checking archive consistency - surely writing it out correctly is good, but rejecting otherwise fine odf is not. --- package/source/zipapi/ZipFile.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'package/source') diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 1278f0994558..4fd8aeab276d 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -688,7 +688,7 @@ sal_Bool ZipFile::readLOC( ZipEntry &rEntry ) // the method can be reset for internal use so it is not checked bBroken = rEntry.nVersion != nVersion - || rEntry.nFlag != nFlag + || rEntry.nMethod != nHow || rEntry.nTime != nTime || rEntry.nPathLen != nPathLen || !rEntry.sPath.equals( sLOCPath ); @@ -698,6 +698,12 @@ sal_Bool ZipFile::readLOC( ZipEntry &rEntry ) bBroken = sal_True; } + // ignore bits 1 & 2 for normal deflate algo - they're purely informative + if( nHow != 8 && nHow != 9 ) + bBroken = bBroken || rEntry.nFlag != nFlag; + else if( (rEntry.nFlag & ~6L) != (nFlag & ~6L) ) + bBroken = true; + if ( bBroken && !bRecoveryMode ) throw ZipIOException( OUString( RTL_CONSTASCII_USTRINGPARAM( "The stream seems to be broken!" ) ), uno::Reference< XInterface >() ); -- cgit