-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Assert fails with Z_HUFFMAN_ONLY #172
Comments
Apparently it's not a problem, since it works without the assert. However I'm not sure what's going on there, so if you would be willing to put together something that reproduces the assertion, I would appreciate it. Thanks. |
@madler I created a repo with minimal code that reproduces the assert when DEBUG is defined. |
Thanks! There is a bug, but it is not serious. When you request stored (level 0) with the Huffman or RLE strategies, it can produce fixed or dynamic blocks. The output will always be valid deflate streams, but it just won't be entirely what was requested. What's happening is that when it's time to emit a block, the Huffman or RLE code has been accumulating symbols and has slid the window back so that the beginning of the current block is no longer available. Since level 0 was requested, it goes to generate a stored block, at which point the assert is triggered. If it continues past the assert, then it determines that it can't emit a stored block, and emits a fixed or dynamic block instead. |
So the assert can merely be commented out to no ill effect? |
Yes, for now. But the underlying bug needs to be fixed so that the application gets what it requested. |
I would say that the "application not getting what it requested" certainly counts as "ill effect." |
Leaving the Assert in with debugging on certainly has ill effect, since then it simply fails when it could have produced valid deflate output. You can't even tell that it didn't give you what you asked for unless you examine the deflate output carefully with special tools (e.g. infgen). You didn't notice. |
Oh so you still get something which, when inflated, gives you back the original plaintext? That's fine. |
Yes. You yourself noted that "If I don't define DEBUG everything seems to work." |
Bug fixed. See 9457585 . Thank you for the report. |
When I define
DEBUG
, ZLib is failing this assertion for one of my cases:The assertion is from this line:
https://github.com/madler/zlib/blob/master/trees.c#L951
Is this something I should be worried about? If necessary, I can put together a stand-alone program that reproduces the defect but before I do that work I want to know if it is an actual problem. If I don't define
DEBUG
everything seems to work. Here is my test code:https://github.com/vinniefalco/Beast/blob/zlib/test/zlib/deflate_stream.cpp#L317
That line fails when
level=0
,windowBits=9
, andstrategy=2
(these are the parameters used in the call todeflateInit2
).The text was updated successfully, but these errors were encountered: