-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
Steps to reproduce
-
Gziped 38KB file
-
Trying to ungzip it supplying into GZipInputStream.Read buffer with the size 10KB (smaller than gzipped array itself). Receive "Unexpected EOF".
-
If to use buffer 50KB (more than gzipped array) - all works.
-
It started to work with smaller buffer when the part in GZipInputStream.Read was remarked:

-
Code for decompressing
public static byte[] Decompress(this byte[] data)
{
if (data == null)
return null;
byte[] unzipped = new byte[10000];
int readOut = 0;
byte[] res = null;
try
{
using (Stream stream = new GZipInputStream(new MemoryStream(data)))
{
using (MemoryStream memory = new MemoryStream())
{
while((readOut = stream.Read(unzipped, 0, unzipped.Length))>0)
memory.Write(unzipped, 0, readOut);
res = memory.ToArray();
memory.Close();
}
stream.Close();
}
}
catch
{
res = null;
}
return res;
}Expected behavior
Unzip
Actual behavior
Unexpected EOF
Version of SharpZipLib
Obtained from (only keep the relevant lines)
- Compiled from source, commit: 6f245b3
Metadata
Metadata
Assignees
Labels
No labels