Hello,
I've committed the patch below.
When a zip file contains an encrypted entry, we should throw a ZipException (as
the JDK does) while reading the zip file directory.
This has been in IKVM.NET's ZipFile implementation (which is a fork of GNU
Classpath's) for a while.
Regards,
Jeroen
Index: java/util/zip/ZipFile.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/zip/ZipFile.java,v
retrieving revision 1.40
diff -u -r1.40 ZipFile.java
--- java/util/zip/ZipFile.java 3 Jun 2010 19:13:21 -0000 1.40
+++ java/util/zip/ZipFile.java 13 Jul 2010 13:23:24 -0000
@@ -261,7 +261,10 @@
if (inp.readLeInt() != CENSIG)
throw new ZipException("Wrong Central Directory signature: " + name);
- inp.skip(6);
+ inp.skip(4);
+ int flags = inp.readLeShort();
+ if ((flags & 1) != 0)
+ throw new ZipException("invalid CEN header (encrypted entry)");
int method = inp.readLeShort();
int dostime = inp.readLeInt();
int crc = inp.readLeInt();