Skip to content

fix(ipc): fill the buffer on partial reads in the sync message reader - #10284

Open
jackylee-ch wants to merge 1 commit into
vortex-data:developfrom
jackylee-ch:fix/ipc-sync-reader-short-read
Open

jackylee-ch wants to merge 1 commit into
vortex-data:developfrom
jackylee-ch:fix/ipc-sync-reader-short-read

Conversation

@jackylee-ch

Copy link
Copy Markdown
Contributor

What

SyncMessageReader did a single read into the resized buffer and handed it to
the decoder. On a short read — legal for any Read, common over pipes and
sockets — the buffer kept its zero padding, which the decoder treats as real data
(it checks remaining(), not bytes written) and decodes as garbage.

Fix

Loop until the buffer is filled before decoding, and report a truncated stream as
an error instead of returning garbage. This mirrors the partial-read handling the
async AsyncMessageReader already has.

AI assistance

Prepared with AI assistance; I have reviewed and verified the change.

`SyncMessageReader` issued a single `read` into the resized buffer and handed it
straight to the decoder. On a short read — legal for any `Read`, common over
pipes and sockets — the buffer kept its zero padding, which the decoder treats
as real data (it checks `remaining()`, not bytes written) and decodes as garbage.

Loop until the buffer is filled before decoding, and report a truncated stream
as an error instead of returning garbage, mirroring the async reader.

Signed-off-by: jackylee-ch <qcsd2011@gmail.com>

This branch has not been deployed

No deployments
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