Details
Description
Trying to extract a ZIP archive that contains entries with STORED compression method, the ZipArchiveInputStream.readStored(byte[], int, int) method is called. At this point, because the buf array has not had a chance to be populated with values from the underlying input stream and because there's no condition to detect this, the resulting content is prefixed with the buffer's length (512) of 0 bytes.
I've found that chancing:
if (buf.position() >= buf.limit()) {
with
if (buf.position() >= buf.limit() || current.bytesReadFromStream == 0) {
solves the issue.
Attachments
Attachments
Issue Links
- duplicates
-
COMPRESS-264 ZIP reads correctly with commons-compress 1.6, gives NUL bytes in 1.7
- Closed