summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorJeroen Frijters <jeroen@sumatra.nl>2010-07-13 13:27:40 +0000
committerJeroen Frijters <jeroen@sumatra.nl>2010-07-13 13:27:40 +0000
commit6fbc7a47004e01458fe678ad5f6134e39ca034be (patch)
treefc7e683c6651b928e60ccc05be896c43c90f6a43 /java
parent61a6204b107cab89065f450a5f580aa2ae348891 (diff)
downloadclasspath-6fbc7a47004e01458fe678ad5f6134e39ca034be.tar.gz
When a zip file contains an encrypted entry, we should throw a ZipException (as the JDK does) while reading the zip file directory.
Diffstat (limited to 'java')
-rw-r--r--java/util/zip/ZipFile.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/java/util/zip/ZipFile.java b/java/util/zip/ZipFile.java
index 3963bcb1e..b582c8493 100644
--- a/java/util/zip/ZipFile.java
+++ b/java/util/zip/ZipFile.java
@@ -261,7 +261,10 @@ public class ZipFile implements ZipConstants
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();