adamhathcock / sharpcompress

SharpCompress is a fully managed C# library to deal with many compression types and formats.
MIT License
2.22k stars 476 forks source link

Fixed extractions after first ZIP64 entry is read from stream #852

Closed pathartl closed 1 week ago

pathartl commented 1 week ago

When a ZIP64 entry is extracted from an archive, the header for the next entry is read out of order. This commit reads the header again, then resets the position of the RewindableStream back to the beginning of the entry, just after the 4 byte header signature. This ensures the correct header signature data and reader (in the correct position) are fed to ReadHeader. Previously this would have read the data at an incorrect offset and would not yield a viable ZipHeader.

I haven't done extensive testing with this nor did I write any automated tests.

pathartl commented 1 week ago

Not sure why tests are failing here... is format formatting issues? Running all tests through VS pass.

adamhathcock commented 1 week ago

format is using csharpier to enforce a code style. The dotnet tool is available locally and dotnet csharpier . should fix the formatting

adamhathcock commented 1 week ago

Thanks!