fix(fsst): reject corrupt symbol tables and offsets on decode - #8588
Merged
Conversation
Treat on-disk FSST symbol lengths and value offsets as untrusted input so a crafted table cannot overflow the 8x decode buffer.
Xuanwo
marked this pull request as ready for review
August 17, 2026 17:07
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
wjones127
self-requested a review
August 19, 2026 15:29
westonpace
approved these changes
Aug 19, 2026
westonpace
requested changes
Aug 19, 2026
westonpace
left a comment
Member
There was a problem hiding this comment.
Changing back to request changes since gatekeeper's suggestions seem valid.
Reject corrupt offsets on the raw-copy path, and return InvalidData when an FSST_ESC is missing its payload inside the current value.
Contributor
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The revision closes both previously identified malformed-input paths: validation now covers switch-off offsets, and escape payloads are bounded to their current value. The decoder now enforces the intended corruption boundary while preserving valid-file behavior and the existing fast-path safety invariants.
westonpace
approved these changes
Aug 20, 2026
westonpace
left a comment
Member
There was a problem hiding this comment.
Nice job! Good to see a safe & fast impl 😄
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.
Why
#7589made the FSST output-buffer contract 8×, but still trusted on-disk symbol lengths and value offsets. A crafted Lance file can inflatelens[]sodecompress_bulkwrites past that buffer. Readers that open untrusted datasets (dataset viewers, upload scanners) crash, and the overflow is a heap write with attacker-controlled values and stride.This change makes
fsst::decompressthe security boundary. Declared symbol lengths must be1..=8. Offsets must convert withto_usize, be non-decreasing, and stay inside the compressed buffer. Corrupt input returnsInvalidData, mapped tocorrupt_fileby the encoding adapters. Valid files and the 8×write_unalignedfast path are unchanged.Benchmark
FSST string decode of a 1 MiB Hamlet corpus, 2000
decompresscalls, release, same host. The measured head is this PR; the baseline isorigin/main(8a8fb20c32).The difference is within run-to-run noise. Decode cost is unchanged.