icsharpcode / SharpZipLib

#ziplib is a Zip, GZip, Tar and BZip2 library written entirely in C# for the .NET platform.
http://icsharpcode.github.io/SharpZipLib/
MIT License
3.73k stars 976 forks source link

Stream returned by ZipFile.GetInputStream() hangs when accessing Length property #767

Closed Sardelka9515 closed 2 years ago

Sardelka9515 commented 2 years ago

Steps to reproduce

  1. Create a new ZipFile instance
  2. Get a Stream object returned by ZipFile.GetInputStream(), and try to get it's length.
  3. Program stuck

Expected behavior

Return the acutal length of the decompressed file. Or throw an expection if it's not possibile.

Actual behavior

When accesing Stream.Length propperty from the object returned by ZipFile.GetInputStream(), execution hangs.

Version of SharpZipLib

Obtained from (only keep the relevant lines)

piksel commented 2 years ago

It should throw, not sure what is happening in your case:

https://github.com/icsharpcode/SharpZipLib/blob/519ed7367daf0a5ad7f2d36bee6e994ffcd7e9e8/src/ICSharpCode.SharpZipLib/Zip/Compression/Streams/InflaterInputStream.cs#L534-L544

Sardelka9515 commented 2 years ago

Ah, my bad. Exception not caught correctly, nevermind