You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug zlib.managed gets stuck in infinite loop on unpacking certain files. Test file is attached. It can be unpacked with zlib.net with no issues.
The deepest call in this loop is Inflate_flush under
zlib.managed.dll!Elskom.Generic.Libs.InfCodes.Proc(Elskom.Generic.Libs.InfBlocks s, Elskom.Generic.Libs.ZlibStream z, Elskom.Generic.Libs.ZlibCompressionState r) Line 398
zlib.managed.dll!Elskom.Generic.Libs.InfBlocks.Proc(Elskom.Generic.Libs.ZlibStream z, Elskom.Generic.Libs.ZlibCompressionState r) Line 565
zlib.managed.dll!Elskom.Generic.Libs.Inflate.Decompress(Elskom.Generic.Libs.ZlibStream z, Elskom.Generic.Libs.ZlibFlushStrategy f) Line 166
zlib.managed.dll!Elskom.Generic.Libs.ZlibStream.Inflate(Elskom.Generic.Libs.ZlibFlushStrategy f) Line 355
zlib.managed.dll!Elskom.Generic.Libs.ZlibStream.Read(byte[] buffer, int offset, int count) Line 175
The problem is Inflate_flush gets this.Read equal this.Write, though q is less than this.End, which makes n to be 0. Nothing is flushed to output with Array.Copy, state does not change, return value is Ok, so on the next iteration we run into exactly the same path.
To Reproduce
Unpack test file from attached zip and run
using (var fsi = File.OpenRead(@"path\to\file.zlib"))
using (var fso = File.OpenWrite(@"path\to\file_unp"))
using (var zlib = new Elskom.Generic.Libs.ZlibStream(fsi, true))
zlib.CopyTo(fso);
Describe the bug
zlib.managed gets stuck in infinite loop on unpacking certain files. Test file is attached. It can be unpacked with zlib.net with no issues.
The deepest call in this loop is Inflate_flush under
The problem is
Inflate_flush
getsthis.Read
equalthis.Write
, thoughq
is less thanthis.End
, which makesn
to be 0. Nothing is flushed to output withArray.Copy
, state does not change, return value isOk
, so on the next iteration we run into exactly the same path.To Reproduce
Unpack test file from attached zip and run
Expected behavior
File is unpacked successfully
Actual behavior
Code is stuck in infinite loop
Version used
main branch (d1fa75f)
file.zip
The text was updated successfully, but these errors were encountered: