Handle large DiagnosticsIPC ProcessInfo payloads gracefully#129994
Merged
tommcdon merged 1 commit intoJun 30, 2026
Conversation
Compute the ProcessInfo/ProcessInfo2/ProcessInfo3/env-info and generate-core-dump response payload sizes in a wide type and return failure when the header plus payload would not fit in the uint16_t message-size field, instead of truncating the length. The *_payload_get_size helpers now return bool with a uint16_t out parameter, and ipc_message_flatten computes the total length in a size_t and fails when it exceeds the representable range. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Diagnostics IPC message construction to prevent silent truncation when response payloads are large, by computing sizes in wider types and failing when the header+payload can’t fit in the protocol’s uint16_t message-size field.
Changes:
- Add a shared helper to validate/narrow payload sizes to a
uint16_twhile accounting for the IPC header size. - Update
ipc_message_flattento compute total message length usingsize_tand fail when it exceedsUINT16_MAX. - Update ProcessInfo/EnvironmentInfo and GenerateCoreDump response payload size helpers to
bool + out uint16_tand adjust callers accordingly.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/native/eventpipe/ds-protocol.h | Adds ds_ipc_payload_size_try_narrow helper to validate/narrow payload sizes for IPC messages. |
| src/native/eventpipe/ds-protocol.c | Computes message length in size_t and errors out if it won’t fit in the uint16_t message-size field. |
| src/native/eventpipe/ds-process-protocol.c | Updates ProcessInfo/EnvInfo payload size computation to use the new narrowing helper and propagates failure to callers. |
| src/native/eventpipe/ds-dump-protocol.c | Updates GenerateCoreDump response payload size computation to use the narrowing helper and short-circuit on overflow. |
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.
Compute the ProcessInfo/ProcessInfo2/ProcessInfo3/env-info and generate-core-dump response payload sizes in a wide type and return failure when the header plus payload would not fit in the uint16_t message-size field, instead of truncating the length. The *_payload_get_size helpers now return bool with a uint16_t out parameter, and ipc_message_flatten computes the total length in a size_t and fails when it exceeds the representable range.