[PR #452] [MERGED] Various fixes for ZIP64 writer (zero byte entries, 32 bit where supported) #1034

Open
opened 2026-01-29 22:18:44 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/adamhathcock/sharpcompress/pull/452
Author: @Lssikkes
Created: 5/24/2019
Status: Merged
Merged: 5/24/2019
Merged by: @adamhathcock

Base: masterHead: master


📝 Commits (1)

  • 9319ea6 Updated ZIP64 writer to write 32 bit values to directory entries for better compatibility.

📊 Changes

2 files changed (+19 additions, -6 deletions)

View changed files

📝 src/SharpCompress/Writers/Zip/ZipCentralDirectoryEntry.cs (+11 -6)
📝 src/SharpCompress/Writers/Zip/ZipWriter.cs (+8 -0)

📄 Description

To improve compatibility with older ZIP clients I've modified the directory headers to write the corresponding 32 bit values if values still fit in 32 bits (this will allow them to read as if it's a ZIP32, and able to completely ignore the extra ZIP64 fields in ZIP headers if the decompressed size <= 32 bits)

Another problem fixed in order not to trip up 7-zip/WinRAR, zero byte files need to have compression value 0 (STORED). Now with zero byte files in the archive they will validate correctly.

I've tested these changes on WinRAR, 7-zip and windows explorer .zip (Windows 10 RS5), and using the latest changes don't get any complaints anymore extracting ZIP/ZIP64.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/adamhathcock/sharpcompress/pull/452 **Author:** [@Lssikkes](https://github.com/Lssikkes) **Created:** 5/24/2019 **Status:** ✅ Merged **Merged:** 5/24/2019 **Merged by:** [@adamhathcock](https://github.com/adamhathcock) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`9319ea6`](https://github.com/adamhathcock/sharpcompress/commit/9319ea69926ff60549081fcc01fb8774b7444e51) Updated ZIP64 writer to write 32 bit values to directory entries for better compatibility. ### 📊 Changes **2 files changed** (+19 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `src/SharpCompress/Writers/Zip/ZipCentralDirectoryEntry.cs` (+11 -6) 📝 `src/SharpCompress/Writers/Zip/ZipWriter.cs` (+8 -0) </details> ### 📄 Description To improve compatibility with older ZIP clients I've modified the directory headers to write the corresponding 32 bit values if values still fit in 32 bits (this will allow them to read as if it's a ZIP32, and able to completely ignore the extra ZIP64 fields in ZIP headers if the decompressed size <= 32 bits) Another problem fixed in order not to trip up 7-zip/WinRAR, zero byte files need to have compression value 0 (STORED). Now with zero byte files in the archive they will validate correctly. I've tested these changes on WinRAR, 7-zip and windows explorer .zip (Windows 10 RS5), and using the latest changes don't get any complaints anymore extracting ZIP/ZIP64. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 22:18:44 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#1034