Check the public surface survives hostile input - #379
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #379 +/- ##
=======================================
Coverage 98.01% 98.01%
=======================================
Files 39 39
Lines 52818 52818
Branches 1105 1105
=======================================
Hits 51770 51770
Misses 795 795
Partials 253 253 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Aug 14, 2026
Closed
Closed
This was referenced Aug 23, 2026
Closed
Closed
This was referenced Aug 31, 2026
Closed
Closed
This was referenced Sep 1, 2026
Closed
Open
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.
The ported tests cover valid input, matching the Java originals. Nothing covers hostile input — and
this session found two crash bugs of that shape by accident: an unbounded
stackallocin the publicNormalize*methods (uncatchableStackOverflowException), andKeyNotFoundExceptiongeocoding anAscension Island number.
~30 inputs (lone surrogates, astral pairs, RTL overrides, NUL, non-ASCII digit scripts, characters
whose numeric value isn't a decimal digit, malformed RFC3966, 10k-char strings) go through
Parse,the normalizers,
IsViablePhoneNumber,ExtractPossibleNumber,FindNumbersandAsYouTypeFormatter, asserting nothing escapes butNumberParseException. Plus odd region codes anda guard for the 200k-char case.
EveryRegionSurvivesTheReadOnlySurfaceruns geocoder, carrier, timezone and short-number lookups overan example number from every region — the shape that would have caught the
ACbug.[Fact]over an array rather than[Theory]/[MemberData], because xunit serialises theoryarguments for discovery and lone surrogates don't survive it.