fix: LZ4 block compressor/decompressor safety issues - #344
Merged
Conversation
zjw1111
approved these changes
Jun 8, 2026
zjw1111
left a comment
Collaborator
There was a problem hiding this comment.
Re-reviewed the latest head and the previous LZ4 output-buffer issue is fixed. No remaining actionable issues from my side.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Purpose
No Linked issue.
src_length < HEADER_LENGTHguard beforeReadIntLEto prevent out-of-bounds read on truncated/corrupted blocks.compressed_size < 0to<= 0sinceLZ4_compress_defaultreturns 0 (not negative) on failure, which previously produced silent corrupt blocks.Tests
TestDecompressTruncatedHeader: Verifies truncated input (3 bytes / 0 bytes) returnsInvalidinstead of reading out-of-bounds.TestCompressInsufficientOutputBuffer: Verifies insufficient output buffer returns error instead of writing a corrupt block.API and Format
Documentation
Generative AI tooling