diff options
author | Jeroen Frijters <jeroen@sumatra.nl> | 2010-07-13 13:27:40 +0000 |
---|---|---|
committer | Jeroen Frijters <jeroen@sumatra.nl> | 2010-07-13 13:27:40 +0000 |
commit | 6fbc7a47004e01458fe678ad5f6134e39ca034be (patch) | |
tree | fc7e683c6651b928e60ccc05be896c43c90f6a43 /java | |
parent | 61a6204b107cab89065f450a5f580aa2ae348891 (diff) | |
download | classpath-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.java | 5 |
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(); |