mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8280404: Unexpected exception thrown when CEN file entry comment length is not valid
Reviewed-by: alanb
This commit is contained in:
parent
8e70f4c3dc
commit
f0995abe62
2 changed files with 355 additions and 1 deletions
|
@ -1206,8 +1206,17 @@ public class ZipFile implements ZipConstants, Closeable {
|
|||
entries[index++] = hash;
|
||||
entries[index++] = next;
|
||||
entries[index ] = pos;
|
||||
// Validate comment if it exists
|
||||
// if the bytes representing the comment cannot be converted to
|
||||
// a String via zcp.toString, an Exception will be thrown
|
||||
int clen = CENCOM(cen, pos);
|
||||
if (clen > 0) {
|
||||
int elen = CENEXT(cen, pos);
|
||||
int start = entryPos + nlen + elen;
|
||||
zcp.toString(cen, start, clen);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
zerror("invalid CEN header (bad entry name)");
|
||||
zerror("invalid CEN header (bad entry name or comment)");
|
||||
}
|
||||
return nlen;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue