mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-06 13:34:58 +00:00
Zip64 - 0 Size on Entry > 4GiB #436
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Nanook on GitHub (Feb 10, 2021).
I have a zip containing 1 file that's greater than 4GiB.
The Entry returns a Size of 0. I've had a look at the code and the correct size appears to be in the RelativeOffsetOfEntryHeader property of the Zip64ExtendedInformationExtraField class.
I've made a workaround but I don't know how correct it is
There appears to be no other header set
if (RelativeOffsetOfEntryHeader == uint.MaxValue)is falseAny advice would be appreciated. I'm happy to try and create a PR. I've not done this before.
@adamhathcock commented on GitHub (Feb 10, 2021):
Might need to research the ZIp64 loading of the Extra is correct
from APPNOTE.txt
The code does different things based on the length which feels wrong:
faf1a9f7e4/src/SharpCompress/Common/Zip/Headers/LocalEntryHeaderExtraFactory.cs (L83)You could be getting the situation were only the uncompressed size is provided but putting it in the wrong field
@Nanook commented on GitHub (Feb 10, 2021):
Thanks, I was apprehensive I'd made a bad assumption so went for the defensive change.
I think you're correct. I don't know which app created the file I'm using so I created another with 7Zip. < 4GiB compressed but > 4GiB decompressed. It has the same behaviour.
Both indicate that length of 8 should be as above. Creating another test zip with a file > 4GiB that compresses to > 4GiB hits
case 16;and works correctly as is. Just thought I'd test that as I don't know how to create the other examples.@adamhathcock commented on GitHub (Feb 10, 2021):
I think that switch statement shouldn't be there. Looking at the spec, there is a given order of values but it can be variable.
So the first 8 bytes, if exists, is always the uncompressed length.
So the next 8 bytes, if exists, is always the compressed length.
So the next 8 bytes, if exists, is always the offset of the local header.
etc.
@Nanook commented on GitHub (Feb 10, 2021):
I think this matches the spec. You beat me to it ha
@adamhathcock commented on GitHub (Feb 14, 2021):
Released https://github.com/adamhathcock/sharpcompress/releases/tag/0.28