[release/11.0-rc1] Reject malformed UTF-8 number separators - #132471
Merged
tannergooding merged 1 commit intoAug 19, 2026
Conversation
`MatchChars<TChar>` currently applies UTF-16 NBSP normalization directly to UTF-8 bytes. This allows a standalone `0xA0` continuation byte to match an ASCII space in a configured number separator, so malformed UTF-8 can parse successfully. Restrict the compatibility normalization to UTF-16 while preserving exact UTF-8 matching. Regression tests cover both the CoreLib numeric parser and the separate `BigInteger` shared-source instantiation. This regressed in #123783. > [!NOTE] > This pull request description was drafted by GitHub Copilot. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
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. |
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-numerics |
Member
|
CC. @jeffhandley, @artl93 |
artl93
approved these changes
Aug 18, 2026
artl93
left a comment
Member
There was a problem hiding this comment.
Core functionality regression. Approved.
Member
|
/ba-g System.Net.HttpListener.Tests timeout |
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.
Backport of #132417 to release/11.0-rc1
/cc @tannergooding
Customer Impact
Malformed UTF-8 can be accepted as valid numeric input when a standalone
0xA0continuation byte occurs where a configured number-format symbol contains an ASCII space. The expected behavior is to reject the malformed input. This affects culture-aware parsing across the CoreLib numeric types and the separateBigIntegershared-source instantiation.Regression
Introduced by #123783 in February 2026. That change intentionally made space/NBSP normalization bidirectional for UTF-16, but inadvertently applied Unicode normalization to individual UTF-8 bytes as well.
Testing
Regression tests were added for both the CoreLib numeric parser (
Int32) andBigInteger; each failed before the fix and passed afterward. A checked CoreLib build succeeded, as did the completeSystem.Runtime.Testssuite (77,366 tests) andSystem.Runtime.Numerics.Testssuite (8,426 tests).The issue was missed because #123783 tested only UTF-16 input even though the modified shared implementation also instantiates over one-byte UTF-8 elements.
Risk
Low. The production change restricts Unicode compatibility normalization to the UTF-16 specialization. Exact UTF-8 matching is unchanged, malformed mismatched bytes are rejected, and the intended bidirectional UTF-16 behavior remains intact. Both shared-source instantiations and their complete test suites were validated.
Note
This pull request description was drafted by GitHub Copilot.