Skip to content

Fix UTF-8 buffer sizing for fatal-error reports - #136666

Merged
AaronRobinsonMSFT merged 3 commits into
dotnet:mainfrom
AaronRobinsonMSFT:arobins/failfast-unicode-report
Oct 30, 2026
Merged

AaronRobinsonMSFT merged 3 commits into
dotnet:mainfrom
AaronRobinsonMSFT:arobins/failfast-unicode-report

Conversation

@AaronRobinsonMSFT

@AaronRobinsonMSFT AaronRobinsonMSFT commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

The console conversion helper assumed two bytes per UTF-16 code unit. Three-byte UTF-8 text could fail conversion and disappear from fatal-error reports.

Inline exact-size, two-pass conversion in PrintToStdErrW and remove the single-use macro. Move regression coverage into the runtime unhandled-exception tests.

The console conversion helper assumes two bytes per UTF-16 code unit,
which can underallocate for UTF-8 and omit text from fatal-error reports.

Use a three-byte UTF-8 bound with overflow protection and exact sizing
for other code pages. Add regression tests for messages and exception text.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: f515d939-a74d-45af-a6be-0170c3f200e0
@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: @dotnet/area-system-runtime
See info in area-owners.md if you want to be subscribed.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke
See info in area-owners.md if you want to be subscribed.

Comment thread src/coreclr/inc/utilcode.h Resolved
Inline exact-size conversion in PrintToStdErrW and remove its single-use
macro, avoiding unnecessary allocation during fatal-error reporting.

Move Unicode report coverage into the existing runtime crash tests.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: f515d939-a74d-45af-a6be-0170c3f200e0
Co-authored-by: Copilot <[email protected]>
Copilot-Session: f515d939-a74d-45af-a6be-0170c3f200e0
@AaronRobinsonMSFT

Copy link
Copy Markdown
Member Author

@jkotas Need one more review. I disabled this test on mono instead of fixing it.

@AaronRobinsonMSFT
AaronRobinsonMSFT enabled auto-merge (squash) October 30, 2026 17:34
@AaronRobinsonMSFT
AaronRobinsonMSFT merged commit 6b3b555 into dotnet:main Oct 30, 2026
109 checks passed
@github-project-automation github-project-automation Bot moved this to Done in AppModel Oct 30, 2026
@AaronRobinsonMSFT
AaronRobinsonMSFT deleted the arobins/failfast-unicode-report branch October 30, 2026 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants