Skip to content

Remove length check on debug log content - #131521

Open
rcj1 wants to merge 1 commit into
dotnet:mainfrom
rcj1:fix-truncation
Open

Remove length check on debug log content#131521
rcj1 wants to merge 1 commit into
dotnet:mainfrom
rcj1:fix-truncation

Conversation

@rcj1

@rcj1 rcj1 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #131073

Copilot AI review requested due to automatic review settings July 29, 2026 07:00
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates CoreCLR’s debugger right-side (DBI) handling for DB_IPCE_FIRST_LOG_MESSAGE by relaxing validation around the logged message content length, while keeping (and tightening) validation for the log switch/category name.

Changes:

  • Remove the 0x10000 max-length validation for log message content in CordbProcess::RawDispatchEvent.
  • Switch the log switch/category length validation to use MAX_LOG_SWITCH_NAME_LEN.
Show a summary per file
File Description
src/coreclr/debug/di/process.cpp Adjusts validation for debugger log-message event handling (category bounded by MAX_LOG_SWITCH_NAME_LEN, content no longer capped by 0x10000).

Copilot's findings

Comments suppressed due to low confidence (1)

src/coreclr/debug/di/process.cpp:4933

  • With the cchContent upper-bound check removed, this block can now overflow when computing cbExpected = cchContent * sizeof(WCHAR), and it also treats a short/partial ReadVirtual as success (cbRead is ignored), which can leave uninitialized data in the buffers passed to the callback. This file already has SafeReadBuffer() which enforces cbRead == expected size and returns ERROR_PARTIAL_COPY.

Recommend adding an overflow guard for the byte-size computation and switching these reads to SafeReadBuffer (or otherwise validating cbRead).

            if (cchCategory > MAX_LOG_SWITCH_NAME_LEN)
            {
                IfFailThrow(E_UNEXPECTED);
            }

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET 11 debugger crash on messages ≥ 65,536 characters

2 participants