Skip to content

[rpc] Bound length-delimited field length against readable bytes#3756

Open
fresh-borzoni wants to merge 1 commit into
apache:mainfrom
fresh-borzoni:rpc-field-length-bound
Open

[rpc] Bound length-delimited field length against readable bytes#3756
fresh-borzoni wants to merge 1 commit into
apache:mainfrom
fresh-borzoni:rpc-field-length-bound

Conversation

@fresh-borzoni

@fresh-borzoni fresh-borzoni commented Jul 23, 2026

Copy link
Copy Markdown
Member

closes #3757
Generated Protobuf decoders allocate new byte[len] for a length-delimited field before checking the declared length fits the bytes present, so a bogus length prefix results in a large allocation.

Added ProtoCodecUtils.readBytesLen, which rejects a length that is negative or larger than the buffer's readable bytes, and route the bytes, string, repeated-bytes and repeated-string decoders through it.

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.

[rpc] RPC decoder allocates before validating field length

1 participant