Skip to content

fix(lance-io): reject malformed message length prefix in read_message_from_buf - #9070

Open
foobar wants to merge 1 commit into
lance-format:mainfrom
foobar:fix/read-message-from-buf-bounds
Open

fix(lance-io): reject malformed message length prefix in read_message_from_buf#9070
foobar wants to merge 1 commit into
lance-format:mainfrom
foobar:fix/read-message-from-buf-bounds

Conversation

@foobar

@foobar foobar commented Sep 9, 2026

Copy link
Copy Markdown

Summary

read_message_from_buf sliced its input with a file-controlled u32 length prefix without bounds checks, so a crafted v1 file, index, or manifest tail panicked the process on open/scan. Mirrors the checks the async read_message already performs.

Test plan

test_read_message_from_buf_rejects_malformed_length_prefix covers the sub-prefix and oversized-prefix cases (both panicked before); cargo test -p lance-io --lib utils::tests, fmt, and clippy -D warnings all clean.

@github-actions github-actions Bot added A-encoding Encoding, IO, file reader/writer bug Something isn't working labels Sep 9, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-changes Latest Gatekeeper recommendation requests changes. label Sep 9, 2026
@foobar
foobar force-pushed the fix/read-message-from-buf-bounds branch from f65308f to 1013731 Compare September 9, 2026 06:44
@lance-gatekeeper lance-gatekeeper Bot removed the K-changes Latest Gatekeeper recommendation requests changes. label Sep 9, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-changes Latest Gatekeeper recommendation requests changes. label Sep 9, 2026
…_from_buf

A file-controlled u32 prefix could slice past the buffer and panic the
process; return an error instead.
@foobar
foobar force-pushed the fix/read-message-from-buf-bounds branch from 1013731 to c344da1 Compare September 9, 2026 11:57
@lance-gatekeeper lance-gatekeeper Bot removed the K-changes Latest Gatekeeper recommendation requests changes. label Sep 9, 2026

@lance-gatekeeper lance-gatekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gate recommendation: approve.

The revision fixes the malformed-length panic at the protobuf framing boundary while preserving valid decoding. The remaining-length comparison is overflow-safe on both 32- and 64-bit targets.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-encoding Encoding, IO, file reader/writer bug Something isn't working K-approved Latest Gatekeeper recommendation permits acceptance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant