[Libreoffice-commits] .: Branch 'libreoffice-3-5' - package/source

Thorsten Behrens thorsten at kemper.freedesktop.org
Wed Dec 14 04:35:41 PST 2011


 package/source/zipapi/ZipFile.cxx |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit bf7f65de1bbd2e12eb68c1c4d68b5193b60f7d3f
Author: Thorsten Behrens <tbehrens at suse.com>
Date:   Wed Dec 14 13:30:34 2011 +0100

    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.

diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index 1278f09..4fd8aea 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 >() );


More information about the Libreoffice-commits mailing list