Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite loop 2 #128

Closed
3 of 8 tasks
tsvx opened this issue Aug 5, 2016 · 3 comments
Closed
3 of 8 tasks

Infinite loop 2 #128

tsvx opened this issue Aug 5, 2016 · 3 comments
Assignees
Labels

Comments

@tsvx
Copy link

tsvx commented Aug 5, 2016

Here is the test data, 29 short files, each deflated with zlib format (header 78-9C and Adler32 footer):
https://www.dropbox.com/s/jrl5rmlx8idafm1/packets.zip?dl=0
First two of them are good, the remaining are bad (broken).
When inflating, some of the bad packets lead to an exception, but some other cause the ininite loop of endless repeated Inflate calls.

Steps to reproduce

  1. Take, for instance, file packet-03 or packet-05.
  2. Try to inflate the contents with Inflater.Inflate with a code like that:
var zbuf  = File.ReadAllBytes("packet-03");
var zlib = new Inflater();
var buf = new byte[1460];
var ms = new MemoryStream();
zlib.SetInput(zbuf);
int n;
while ((n = zlib.Inflate(buf)) > 0)
{
    ms.Write(buf, 0, n);
}
if (!zlib.IsFinished)
    throw new InvalidOperationException("Inflater not finished!");
return ms.ToArray();

Expected behavior

There should be an exception while inflating.

Actual behavior

You'll get into an infinite loop of generating endless zero bytes.

Version of SharpZipLib

0.86.0.518
master on 2016-08-03

Obtained from (place an x between the brackets for all that apply)

  • Compiled from source
    • branch: master
    • commit: _______
  • Downloaded DLL from GitHub
  • Downloaded DLL from SourceForge
  • Downloaded DLL from _______
  • DLL included as part of
  • Package installed using:
    • NuGet
    • MyGet
    • Chocolatey
@tsvx
Copy link
Author

tsvx commented Aug 6, 2016

I'm not sure if it is related to #88.

@McNeight McNeight added the bug label Aug 13, 2016
@McNeight McNeight self-assigned this Aug 13, 2016
@piksel
Copy link
Member

piksel commented Sep 16, 2018

packets.zip

Adding provided test file to issue.

@piksel
Copy link
Member

piksel commented Nov 22, 2020

Fixed by #316

@piksel piksel closed this as completed Nov 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants