fix(ipc): reject buffer alignments no reader can accept - #9880
Open
jackylee-ch wants to merge 1 commit into
Open
jackylee-ch wants to merge 1 commit into
jackylee-ch wants to merge 1 commit into
Conversation
`MessageDecoder` reads the buffer alignment back through `Alignment::try_from_untrusted_exponent`, which refuses anything above `Alignment::MAX_UNTRUSTED` (64 KiB). The encoder wrote whatever exponent the buffer carried, so a larger alignment produced a stream that written successfully and then failed on every read. Bail at the write site instead, where the caller still has the buffer. Signed-off-by: jackylee-ch <qcsd2011@gmail.com>
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.
MessageDecoderreads the buffer alignment back throughAlignment::try_from_untrusted_exponent(messages/decoder.rs:144), which bails aboveAlignment::MAX_UNTRUSTED— 64 KiB, peralignment.rs:23. The encoder wrote whatever exponentthe buffer carried (
messages/encoder.rs:93), so a buffer aligned beyond that wrote successfullyand then failed on every read, with the error surfacing on the reader's side.
encodealready returnsVortexResult, so the check costs nothing structurally.This is the write-side half of #9155, which added the read-side ceiling; it does not overlap
#9186, which bounds the allocations the decoder asks for.
Tests
cargo test --release -p vortex-ipc: 8 passed, 6 before. The accepting case covers 1 B through64 KiB, the rejecting case 128 KiB and 1 MiB. Disabling the new guard fails the rejecting test and
leaves the accepting one green.
AI assistance
Written with agentic AI assistance; I read the decoder's call to
try_from_untrusted_exponentand theMAX_UNTRUSTEDdefinition before adding the bound.