SharpZipLib: Reading deflate file throw "Unexpected EOF"
Describe the bug
Hello community,
i am not really firm with deflate compremissed files but with the attached file (data.zip) i get a unexpeced EOF exception from the InflaterInputStream
class. It is reproducible with the following code at line var size = _inflater.Read(data, 0, data.Length);
using (var input = new FileStream(@"data4.bin", FileMode.Open))
{
using (var output = new MemoryStream(65536))
{
using (var _inflater = new InflaterInputStream(input))
{
var data = new byte[4096];
while (true)
{
data = new byte[4096];
var size = _inflater.Read(data, 0, data.Length);
if (size > 0)
{
output.Write(data, 0, size);
}
else
{
break;
}
}
}
}
}
Best regards Daniel
Reproduction Code
No response
Steps to reproduce
Create a console app, add the latest release as nuget package of SharpZipLib and run the above code.
Expected behavior
It should not throw a exception
Operating System
Windows
Framework Version
No response
Tags
No response
Additional context
No response
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 22 (9 by maintainers)
It seems like the only thing we can do is to add a way to ignore the CRC (in the library, that is). It should be a useful option to have in any caseā¦