sharpcompress icon indicating copy to clipboard operation
sharpcompress copied to clipboard

ZIP64 Streaming Extraction Failure

Open pathartl opened this issue 1 year ago • 3 comments
trafficstars

I've been able to pretty consistently replicate an issue extracting ZIP64's in a stream where it will extract all entries up until a >4GB file and then silently skip over every other entry.

I believe the issue may lie with how the header is read in StreamingZipHeaderFactory. From my limited testing it seems like it's trying to read the header for the next entry 16 bytes past the start of the actual header. This causes ZipHeaderFactory.ReadHeader to return null and stops reading more of the archive.

pathartl avatar Mar 07 '24 02:03 pathartl

Definitely seems like a bug in the ZIP64 byte reading. Back to reading the spec. Maybe a bug in Reader vs Archive

adamhathcock avatar Mar 07 '24 10:03 adamhathcock

Do we have a test file or test file generator for this one?

Erior avatar Jun 09 '24 20:06 Erior

Might have fixed in PR #852

Haven't looked into why tests are failing. I was able to create a test archive by zipping a couple of small files, then a large >4GB file, and then another couple of small files. Might need to be in alphabetical order to replicate the original issue correctly. The extraction would skip any files after the first ZIP64 file is extracted because of the improper handling of the header data.

pathartl avatar Jun 22 '24 05:06 pathartl