Skip to content

WIP underflow fixes#1059

Draft
keegancsmith wants to merge 2 commits into
mainfrom
k/fix-compound-shard-bug
Draft

WIP underflow fixes#1059
keegancsmith wants to merge 2 commits into
mainfrom
k/fix-compound-shard-bug

Conversation

@keegancsmith
Copy link
Copy Markdown
Member

No description provided.

keegancsmith and others added 2 commits May 12, 2026 15:55
Compound shards can preserve enough table shape to load while still having rune-end offsets that do not map back to the file content boundaries used for slicing. That leaves the first visible failure to happen much later during matching, where the corrupted offset is harder to diagnose and may panic.\n\nValidate the content and filename rune boundary maps at shard load time so bad shards fail with a corruption error at the source of the invariant violation.

Amp-Thread-ID: https://ampcode.com/threads/T-019e1c72-ee98-721f-a530-aa1de8d8ef65
Co-authored-by: Amp <amp@ampcode.com>
A corrupt rune-to-byte mapping can make offset lookup land outside the current file. Letting that value underflow or flow into candidate content slicing turns an index invariant violation into a search-time panic.\n\nKeep offset conversion within the current file's byte range and make candidate verification treat out-of-bounds offsets as non-matches, so corrupted shards fail safely instead of crashing while matching.

Amp-Thread-ID: https://ampcode.com/threads/T-019e1c72-ee98-721f-a530-aa1de8d8ef65
Co-authored-by: Amp <amp@ampcode.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant