fix: return error instead of OOM on corrupt binary page offsets#6392
Open
westonpace wants to merge 2 commits intolance-format:mainfrom
Open
fix: return error instead of OOM on corrupt binary page offsets#6392westonpace wants to merge 2 commits intolance-format:mainfrom
westonpace wants to merge 2 commits intolance-format:mainfrom
Conversation
When reading a corrupt lance file where binary page offsets are non-monotonic (e.g. due to multipart upload part reordering), the subtraction `val - prev` would underflow, producing a huge value used as a byte-range length and triggering an OOM allocation. Use checked_sub to detect the underflow and return a descriptive error instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Summary
val - previnIndicesNormalizer::extendwould underflow, producing a huge value used as a byte-range length, triggering an OOM allocation that kills the process.checked_subto detect the underflow and return a descriptive error message instead, indicating the file data has been corrupted.Context
This was discovered investigating a real-world corruption where two adjacent 5MB multipart upload parts were swapped when writing to an S3 Express directory bucket. The swapped parts caused the binary (string) column's cumulative offset indices to be non-monotonic at the part boundary, leading to the underflow.
Test plan
cargo check -p lance-encoding)🤖 Generated with Claude Code