You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, consumer calls twice. (It should be once)
With Xcode debugger, I notice that the test calls Data.process method with bufferSize = 0. Data.process creates 0-byte Data inifinity.
NOTE: macOS can creates Zip file have 0byte compressed entry. I create sample zip file and attach in this issue.
It contains 0 byte "empty.txt" and 86336byte "faust.txt"
(zip command creates stored no-compressed entry for 0 byte file)
Thanks for updating the issue and for providing a test file. compressedSize being bigger than uncompressedSize for zero-length entries is an edge case I didn't think about 🙈.
I can't promise when I'll find time to fix this, but if you need this, you can submit a PR and I'll do my best to review it.
Summary
Extract a compressed 0byte file, Consumer callback is called infinitely.
I write my code using entry.uncompressedSize for bufferSize to reduce count of consumer closure is called.
(like below test)
My app has infinitely loop.
Steps to Reproduce
This test never stop.
Put testExtractCopressedEmptyData.zip to Tests/ZIPFoundationTests/Resources
To stop infinity loop, I can rewrite the extract code:
However, consumer calls twice. (It should be once)
With Xcode debugger, I notice that the test calls
Data.process
method withbufferSize
= 0.Data.process
creates 0-byte Data inifinity.NOTE: macOS can creates Zip file have 0byte compressed entry. I create sample zip file and attach in this issue.
It contains 0 byte "empty.txt" and 86336byte "faust.txt"
(zip command creates stored no-compressed entry for 0 byte file)
Method
Defl:N
means deflated entry.Expected Results
consumer closure called only once with empty data (
Data()
)Actual Results
consumer closure called infinitely.
Regression & Version
I am using v0.9.11
Xcode 12.2 & macOS 10.15.7
Related Link
The text was updated successfully, but these errors were encountered: