Skip to content

Fix infinite loop on bad literal data (Issue #229)#233

Merged
piksel merged 3 commits into
icsharpcode:masterfrom
piksel:deflate-literal-overflow
Jul 12, 2018
Merged

Fix infinite loop on bad literal data (Issue #229)#233
piksel merged 3 commits into
icsharpcode:masterfrom
piksel:deflate-literal-overflow

Conversation

@piksel

@piksel piksel commented Jun 16, 2018

Copy link
Copy Markdown
Member

If no end symbol is reached before the memory in the output window runs out, it will just be flushed to the output and reset the window without progressing. This causes an infinite loop on bad Huffman data (32768 consecutive literals).
This is caused by allowing bad values into the table and this fix only prevents the infinite loop, not the real cause.

I certify that I own, and have sufficient rights to contribute, all source code and related material intended to be compiled or integrated with the source code for the SharpZipLib open source product (the "Contribution"). My Contribution is licensed under the MIT License.

piksel added 3 commits June 16, 2018 20:03
Returning true here just puts us in an infinite loop, not sure what was supposed to happen?

Fixes icsharpcode#229.
 - No more gotos (!)
 - Easier to read
 - Handles bad table lengths correctly
@piksel piksel added zip Related to ZIP file format ready PR ready for merging when appropriate labels Jul 1, 2018
@piksel piksel added this to the 1.0 milestone Jul 5, 2018
@piksel piksel merged commit c162f19 into icsharpcode:master Jul 12, 2018
@piksel piksel deleted the deflate-literal-overflow branch July 12, 2018 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready PR ready for merging when appropriate zip Related to ZIP file format

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant