Bug 217285 - URLParser should fail to parse URLs with hosts containing invalid punycode encodings
Summary: URLParser should fail to parse URLs with hosts containing invalid punycode en...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-10-03 15:54 PDT by Alex Christensen
Modified: 2020-10-05 07:52 PDT (History)
6 users (show)

See Also:


Attachments
Patch (19.91 KB, patch)
2020-10-03 15:56 PDT, Alex Christensen
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Christensen 2020-10-03 15:54:25 PDT
URLParser should fail to parse URLs with hosts containing invalid punycode encodings
Comment 1 Alex Christensen 2020-10-03 15:56:29 PDT
Created attachment 410445 [details]
Patch
Comment 2 Darin Adler 2020-10-04 14:46:15 PDT
Comment on attachment 410445 [details]
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 "-".
Comment 3 Alex Christensen 2020-10-05 07:51:32 PDT
http://trac.webkit.org/r267965
Comment 4 Radar WebKit Bug Importer 2020-10-05 07:52:21 PDT
<rdar://problem/69954230>