I found the following issue with SharpZipLib 0.85.4.369 (as well the nightly build 0.85.5.407).
My situation is that I have a SharpZipLib created ZIP archive that contains a >4GB uncompressed file (and >2GB compressed - this is the important part) along with some other smaller files. I am able to decompress this with WinZip 9.0 with no problem, but if I even iterate over the ZipEntrys with SharpZipLib 369, it throws a ZipException("Zip archive ends early.") from ZipInputStream.CloseEntry().
The problem is that the signed 32 bit int 'skipped' local variable is overflowing, and the value goes negative when dealing with > 2^31 byte compressed files. To workaround this, I just made 'skipped' a long and removed the cast, although I didn't really look at the problem enough to know if this is the best solution.
Here is a quick test fragment to demonstrate this issue;
string filename = "test.zip";
Random rand = new Random();
using(ZipOutputStream zos = new ZipOutputStream(File.Create(filename)))
{
zos.SetLevel(1);
long size = 2500000000;
ZipEntry entry = new ZipEntry("bigfile");
entry.Size = size;
zos.PutNextEntry(entry);
long bytesLeft = size;
do
{
int bytesToWrite = (int)(bytesLeft > 65535 ? 65535 : bytesLeft);
byte[ ] buffer = new byte[bytesToWrite];
rand.NextBytes(buffer);
zos.Write(buffer, 0, bytesToWrite);
bytesLeft -= bytesToWrite;
}
while(bytesLeft > 0);
}
long uncompressedSize = 0;
using(ZipInputStream zis = new ZipInputStream(File.OpenRead(filename)))
{
ZipEntry entry;
while((entry = zis.GetNextEntry()) != null)
{
uncompressedSize += entry.Size;
}
}