deflate: Better Huffman.construct errors and error handling #9880
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This brings Huffman.construct error handling in line with puff.c (I'm assuming we're okay with treating
puff.c
as an oracle). The error names and logic are from puff.c (and zlib's inflate.c uses the same terminology).Note: I am planning to add relevant test cases soon. EDIT: Done
This is the last piece of the puzzle for getting the deflate.zig <-> puff.c comparison fuzzer (which checks that all inputs either give the same inflated output or give errors in both implementations) to run cleanly (so far at least). Other required puzzle pieces:
cc @LemonBoy @mattbork