Closed
Description
I believe this issue is still not fixed (tested in 2.9.0). The attached simple example of writing a zip archive with just two directories using ZipOutputStream and then reading with ZipInputStream fails to read the second entry.
The offending code seems to be in ZipInputStream.read(byte[], int, int) lines 155-157:
if (localFileHeader.isDirectory()) { return -1; }
Since this stops reading before endOfCompressedDataRecord() can be called, and subsequently read the data descriptor block. Reading the next entry then silently fails because the signature is for a data descriptor and not a local file header.
Zip4jDirectoryDataDescriptorBug.zip
Originally posted by @mbach979 in #309 (comment)
Metadata
Metadata
Assignees
Labels
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
#354 Skip checking for directory when reading entries
srikanth-lingala commentedon Sep 3, 2021
Thanks for your analysis and also the sample code to test the issue. It really helped. I fixed the issue and I will include the fix in next release.
#354 Fix failing test
srikanth-lingala commentedon Nov 18, 2021
Fixed in v2.9.1 released today.