Skip to content

userdata: fix out-of-bounds panic in Get#359

Open
aojea wants to merge 1 commit intogoogle:mainfrom
aojea:get_common_oob
Open

userdata: fix out-of-bounds panic in Get#359
aojea wants to merge 1 commit intogoogle:mainfrom
aojea:get_common_oob

Conversation

@aojea
Copy link
Contributor

@aojea aojea commented Mar 6, 2026

The Get function previously attempted to slice the userdata buffer before verifying that the buffer was large enough to contain the declared length. This would cause a panic when processing truncated or malformed data.

This patch adds a bounds check to ensure the remaining slice length is sufficient before performing the sub-slice operation.

Added a regression test to verify that malformed TLV data is handled gracefully without panicking.

The Get function previously attempted to slice the userdata buffer before
verifying that the buffer was large enough to contain the declared length.
This would cause a panic when processing truncated or malformed data.

This patch adds a bounds check to ensure the remaining slice length is
sufficient before performing the sub-slice operation.

Added a regression test to verify that malformed TLV data is handled
gracefully without panicking.

Signed-off-by: Antonio Ojea <aojea@google.com>
@aojea
Copy link
Contributor Author

aojea commented Mar 6, 2026

/assign @nickgarlis @stapelberg

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.

2 participants