Skip to content

fix(layout): reject list layout offsets that cannot match the row count - #11116

Closed
gitRasheed wants to merge 1 commit into
vortex-data:developfrom
gitRasheed:list-layout-metadata-checks
Closed

gitRasheed wants to merge 1 commit into
vortex-data:developfrom
gitRasheed:list-layout-metadata-checks

Conversation

@gitRasheed

Copy link
Copy Markdown
Contributor

Summary

The vortex.list layout accepts list nodes whose offsets can't describe the parent rows. ListLayoutMetadata accepts any PType for the offsets, including floats, although the reader treats offsets as integers (elements_range_from_offsets panics through vortex_expect when an offset doesn't convert to u64). Deserialization also compares offsets.row_count().saturating_sub(1) with the row count, so it accepts a zero-row list node with no offsets.

Changes

  • ListLayoutMetadata::get_offsets_ptype rejects non-integer offsets types.
  • Deserialization requires the offsets child to have exactly row_count + 1 rows, computed with checked_add.
  • ListLayout::new panics 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 + 1 offsets, so the files it writes are unaffected.

Tests

  • deserialize_rejects_malformed_offsets: the float_offsets and zero_rows_without_offsets cases fail on develop, which accepts both. row_count_overflow already fails to deserialize on develop, and now reports the overflow instead of a mismatch.
  • deserialize_accepts_a_zero_row_node_with_one_offset passes 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 warnings and cargo +nightly-2026-09-10 fmt --check for both.

I used AI tools to help write and review this change.

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>
@gitRasheed

Copy link
Copy Markdown
Contributor Author

#11442 adds the same checks, so I'll close this in favour of it.

@gitRasheed gitRasheed closed this Nov 20, 2026
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