Repository navigation
fix(layout): reject list layout offsets that cannot match the row count - #11116
Closed
gitRasheed wants to merge 1 commit into
Closed
gitRasheed wants to merge 1 commit into
gitRasheed wants to merge 1 commit into
Conversation
List layout metadata accepted float offsets, and deserialization compared offsets rows minus one (saturating) with the row count, so a zero-row node with no offsets passed. Require an integer offsets type and exactly row_count + 1 offset rows. Signed-off-by: gitRasheed <99349713+gitRasheed@users.noreply.github.com>
Contributor
Author
|
#11442 adds the same checks, so I'll close this in favour of it. |
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
The
vortex.listlayout accepts list nodes whose offsets can't describe the parent rows.ListLayoutMetadataaccepts any PType for the offsets, including floats, although the reader treats offsets as integers (elements_range_from_offsetspanics throughvortex_expectwhen an offset doesn't convert to u64). Deserialization also comparesoffsets.row_count().saturating_sub(1)with the row count, so it accepts a zero-row list node with no offsets.Changes
ListLayoutMetadata::get_offsets_ptyperejects non-integer offsets types.row_count + 1rows, computed withchecked_add.ListLayout::newpanics on the same two cases, an offsets child with no rows or a non-integer type, as it already does on a wrong child count.The writer always emits
row_count + 1offsets, so the files it writes are unaffected.Tests
deserialize_rejects_malformed_offsets: thefloat_offsetsandzero_rows_without_offsetscases fail on develop, which accepts both.row_count_overflowalready fails to deserialize on develop, and now reports the overflow instead of a mismatch.deserialize_accepts_a_zero_row_node_with_one_offsetpasses before and after: a zero-row node with one offset, which is what the writer writes for an empty chunk, is still accepted.Checked locally:
cargo test -p vortex-layout -p vortex-file,cargo clippy --all-targets -- -D warningsandcargo +nightly-2026-09-10 fmt --checkfor both.I used AI tools to help write and review this change.