[webkit-reviews] review granted: [Bug 217285] URLParser should fail to parse URLs with hosts containing invalid punycode encodings : [Attachment 410445] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Oct 4 14:46:15 PDT 2020


Darin Adler <darin at apple.com> has granted Alex Christensen
<achristensen at apple.com>'s request for review:
Bug 217285: URLParser should fail to parse URLs with hosts containing invalid
punycode encodings
https://bugs.webkit.org/show_bug.cgi?id=217285

Attachment 410445: Patch

https://bugs.webkit.org/attachment.cgi?id=410445&action=review




--- Comment #2 from Darin Adler <darin at apple.com> ---
Comment on attachment 410445
  --> https://bugs.webkit.org/attachment.cgi?id=410445
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=410445&action=review

> Source/WTF/wtf/URLParser.cpp:2514
> +    if (domain.isAllASCII() && !domain.startsWithIgnoringASCIICase("xn--"))
{

This can use the simpler, more efficient startsWithLettersIgnoringASCIICase.
And there is a version that works on StringImpl& so there is no need to change
the argument type:

    if (domain.isAllASCII() && !startWithLettersIgnoringASCIICase(domain,
"xn--")) {

The name says "letters", but it also works correctly with other ASCII
characters in the 0x20-0x3F and 0x60-0x7F ranges, which includes "-".


More information about the webkit-reviews mailing list