|
@@ -538,6 +538,9 @@ public class ZipFile implements Closeable { |
|
|
ze.setExternalAttributes(ZipLong.getValue(CFH_BUF, off)); |
|
|
ze.setExternalAttributes(ZipLong.getValue(CFH_BUF, off)); |
|
|
off += WORD; |
|
|
off += WORD; |
|
|
|
|
|
|
|
|
|
|
|
if (archive.length() - archive.getFilePointer() < fileNameLen) { |
|
|
|
|
|
throw new EOFException(); |
|
|
|
|
|
} |
|
|
final byte[] fileName = new byte[fileNameLen]; |
|
|
final byte[] fileName = new byte[fileNameLen]; |
|
|
archive.readFully(fileName); |
|
|
archive.readFully(fileName); |
|
|
ze.setName(entryEncoding.decode(fileName), fileName); |
|
|
ze.setName(entryEncoding.decode(fileName), fileName); |
|
@@ -547,12 +550,18 @@ public class ZipFile implements Closeable { |
|
|
// data offset will be filled later |
|
|
// data offset will be filled later |
|
|
entries.add(ze); |
|
|
entries.add(ze); |
|
|
|
|
|
|
|
|
|
|
|
if (archive.length() - archive.getFilePointer() < extraLen) { |
|
|
|
|
|
throw new EOFException(); |
|
|
|
|
|
} |
|
|
final byte[] cdExtraData = new byte[extraLen]; |
|
|
final byte[] cdExtraData = new byte[extraLen]; |
|
|
archive.readFully(cdExtraData); |
|
|
archive.readFully(cdExtraData); |
|
|
ze.setCentralDirectoryExtra(cdExtraData); |
|
|
ze.setCentralDirectoryExtra(cdExtraData); |
|
|
|
|
|
|
|
|
setSizesAndOffsetFromZip64Extra(ze, offset, diskStart); |
|
|
setSizesAndOffsetFromZip64Extra(ze, offset, diskStart); |
|
|
|
|
|
|
|
|
|
|
|
if (archive.length() - archive.getFilePointer() < commentLen) { |
|
|
|
|
|
throw new EOFException(); |
|
|
|
|
|
} |
|
|
final byte[] comment = new byte[commentLen]; |
|
|
final byte[] comment = new byte[commentLen]; |
|
|
archive.readFully(comment); |
|
|
archive.readFully(comment); |
|
|
ze.setComment(entryEncoding.decode(comment)); |
|
|
ze.setComment(entryEncoding.decode(comment)); |
|
@@ -878,9 +887,18 @@ public class ZipFile implements Closeable { |
|
|
} |
|
|
} |
|
|
lenToSkip -= skipped; |
|
|
lenToSkip -= skipped; |
|
|
} |
|
|
} |
|
|
|
|
|
if (archive.length() - archive.getFilePointer() < extraFieldLen) { |
|
|
|
|
|
throw new EOFException(); |
|
|
|
|
|
} |
|
|
final byte[] localExtraData = new byte[extraFieldLen]; |
|
|
final byte[] localExtraData = new byte[extraFieldLen]; |
|
|
archive.readFully(localExtraData); |
|
|
archive.readFully(localExtraData); |
|
|
ze.setExtra(localExtraData); |
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
ze.setExtra(localExtraData); |
|
|
|
|
|
} catch (RuntimeException ex) { |
|
|
|
|
|
final ZipException z = new ZipException("Invalid extra data in entry " + ze.getName()); |
|
|
|
|
|
z.initCause(ex); |
|
|
|
|
|
throw z; |
|
|
|
|
|
} |
|
|
offsetEntry.dataOffset = offset + LFH_OFFSET_FOR_FILENAME_LENGTH |
|
|
offsetEntry.dataOffset = offset + LFH_OFFSET_FOR_FILENAME_LENGTH |
|
|
+ SHORT + SHORT + fileNameLen + extraFieldLen; |
|
|
+ SHORT + SHORT + fileNameLen + extraFieldLen; |
|
|
|
|
|
|
|
|