URLParser should correctly canonicalize uppercase IPv6 addresses
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Sep 2016 21:12:04 +0000 (21:12 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Sep 2016 21:12:04 +0000 (21:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=162680

Reviewed by Tim Horton.

Source/WebCore:

Covered by a new API test.

* platform/URLParser.cpp:
(WebCore::URLParser::parseIPv6Host):
If there is an uppercase character in the IPv6 address part, then it is a syntax violation
because the canonicalized IPv6 address differs from the input String.

Tools:

* TestWebKitAPI/Tests/WebCore/URLParser.cpp:
(TestWebKitAPI::TEST_F):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206547 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/URLParser.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp

index bdea7d9..d065e01 100644 (file)
@@ -1,3 +1,17 @@
+2016-09-28  Alex Christensen  <achristensen@webkit.org>
+
+        URLParser should correctly canonicalize uppercase IPv6 addresses
+        https://bugs.webkit.org/show_bug.cgi?id=162680
+
+        Reviewed by Tim Horton.
+
+        Covered by a new API test.
+
+        * platform/URLParser.cpp:
+        (WebCore::URLParser::parseIPv6Host):
+        If there is an uppercase character in the IPv6 address part, then it is a syntax violation
+        because the canonicalized IPv6 address differs from the input String.
+
 2016-09-28  Chris Dumez  <cdumez@apple.com>
 
         Unreviewed, fix iOS build.
index 45eba4f..5448007 100644 (file)
@@ -2111,6 +2111,8 @@ Optional<URLParser::IPv6Address> URLParser::parseIPv6Host(CodePointIterator<Char
                 break;
             if (!isASCIIHexDigit(*c))
                 break;
+            if (isASCIIUpper(*c))
+                syntaxViolation(hostBegin);
             value = value * 0x10 + toASCIIHexValue(*c);
             advance(c, hostBegin);
         }
index fbac108..7d54108 100644 (file)
@@ -1,3 +1,13 @@
+2016-09-28  Alex Christensen  <achristensen@webkit.org>
+
+        URLParser should correctly canonicalize uppercase IPv6 addresses
+        https://bugs.webkit.org/show_bug.cgi?id=162680
+
+        Reviewed by Tim Horton.
+
+        * TestWebKitAPI/Tests/WebCore/URLParser.cpp:
+        (TestWebKitAPI::TEST_F):
+
 2016-09-27  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Adopt MediaRemote SPI to achieve desired Now Playing behavior
index 4304084..5ea9b9d 100644 (file)
@@ -250,6 +250,7 @@ TEST_F(URLParserTest, Basic)
     checkURL("about:~", {"about", "", "", "", 0, "~", "", "", "about:~"});
     checkURL("https://@test@test@example:800\\path@end", {"", "", "", "", 0, "", "", "", "https://@test@test@example:800\\path@end"});
     checkURL("http://www.example.com/#a\nb\rc\td", {"http", "", "", "www.example.com", 0, "/", "", "abcd", "http://www.example.com/#abcd"});
+    checkURL("http://[A:b:c:DE:fF:0:1:aC]/", {"http", "", "", "[a:b:c:de:ff:0:1:ac]", 0, "/", "", "", "http://[a:b:c:de:ff:0:1:ac]/"});
 
     // This disagrees with the web platform test for http://:@www.example.com but agrees with Chrome and URL::parse,
     // and Firefox fails the web platform test differently. Maybe the web platform test ought to be changed.