- 
                Notifications
    
You must be signed in to change notification settings  - Fork 5.2k
 
Remove more unsafe code from Uri internals #121270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…tString, InternalIsWellFormedOriginalString
| 
           Tagging subscribers to this area: @dotnet/ncl  | 
    
| 
           @MihuBot benchmark Perf_Uri -long -noTimeLimit  | 
    
| { | ||
| valid = IriHelper.CheckIriUnicodeRange(c, str[i + 1], out _, true); | ||
| valid = IriHelper.CheckIriUnicodeRange(c, span[i + 1], out _, true); | ||
| i++; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a bug in previous logic - since we didn't increment i when encountering a surrogate pair, the next iteration would see an unpaired low surrogate and mark the input as non-iri-canonical.
          System.Tests.Perf_Uri
  | 
    
Removes unsafe code from
CheckCanonicaland all its callers.InternalIsWellFormedOriginalStringwas also checking the same thing twice, and we also check for it during parsing, so I added a new flag for it to avoid the duplication (SchemeNotCanonical_NoTrailingSlashes).Reviewing is easier without whitespace diffs.
Draft while I gett more perf numbers.