Title: [257419] releases/WebKitGTK/webkit-2.28
Revision
257419
Author
[email protected]
Date
2020-02-26 02:54:52 -0800 (Wed, 26 Feb 2020)

Log Message

Merge r256629 - Allow UIDNAInfo.errors from uidna_nameToUnicode that would not cause URL parsing failures
https://bugs.webkit.org/show_bug.cgi?id=207360
<rdar://problem/57825317>

Patch by Alex Christensen <[email protected]> on 2020-02-14
Reviewed by Ryosuke Niwa.

Source/WTF:

* wtf/URLHelpers.cpp:
(WTF::URLHelpers::mapHostName):

Tools:

* TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.28/Source/WTF/ChangeLog (257418 => 257419)


--- releases/WebKitGTK/webkit-2.28/Source/WTF/ChangeLog	2020-02-26 10:54:43 UTC (rev 257418)
+++ releases/WebKitGTK/webkit-2.28/Source/WTF/ChangeLog	2020-02-26 10:54:52 UTC (rev 257419)
@@ -1,3 +1,14 @@
+2020-02-14  Alex Christensen  <[email protected]>
+
+        Allow UIDNAInfo.errors from uidna_nameToUnicode that would not cause URL parsing failures
+        https://bugs.webkit.org/show_bug.cgi?id=207360
+        <rdar://problem/57825317>
+
+        Reviewed by Ryosuke Niwa.
+
+        * wtf/URLHelpers.cpp:
+        (WTF::URLHelpers::mapHostName):
+
 2020-02-12  Yusuke Suzuki  <[email protected]>
 
         [JSC] Compact JITCodeMap by storing BytecodeIndex and CodeLocation separately

Modified: releases/WebKitGTK/webkit-2.28/Source/WTF/wtf/URLHelpers.cpp (257418 => 257419)


--- releases/WebKitGTK/webkit-2.28/Source/WTF/wtf/URLHelpers.cpp	2020-02-26 10:54:43 UTC (rev 257418)
+++ releases/WebKitGTK/webkit-2.28/Source/WTF/wtf/URLHelpers.cpp	2020-02-26 10:54:52 UTC (rev 257419)
@@ -548,7 +548,8 @@
     UErrorCode uerror = U_ZERO_ERROR;
     UIDNAInfo processingDetails = UIDNA_INFO_INITIALIZER;
     int32_t numCharactersConverted = (decodeFunction ? uidna_nameToASCII : uidna_nameToUnicode)(&URLParser::internationalDomainNameTranscoder(), sourceBuffer.data(), length, destinationBuffer, hostNameBufferLength, &processingDetails, &uerror);
-    if (length && (U_FAILURE(uerror) || processingDetails.errors))
+    int allowedErrors = decodeFunction ? 0 : UIDNA_ERROR_EMPTY_LABEL | UIDNA_ERROR_LEADING_HYPHEN | UIDNA_ERROR_TRAILING_HYPHEN | UIDNA_ERROR_HYPHEN_3_4;
+    if (length && (U_FAILURE(uerror) || processingDetails.errors & ~allowedErrors))
         return nullopt;
     
     if (numCharactersConverted == static_cast<int32_t>(length) && !memcmp(sourceBuffer.data(), destinationBuffer, length * sizeof(UChar)))

Modified: releases/WebKitGTK/webkit-2.28/Tools/ChangeLog (257418 => 257419)


--- releases/WebKitGTK/webkit-2.28/Tools/ChangeLog	2020-02-26 10:54:43 UTC (rev 257418)
+++ releases/WebKitGTK/webkit-2.28/Tools/ChangeLog	2020-02-26 10:54:52 UTC (rev 257419)
@@ -1,3 +1,14 @@
+2020-02-14  Alex Christensen  <[email protected]>
+
+        Allow UIDNAInfo.errors from uidna_nameToUnicode that would not cause URL parsing failures
+        https://bugs.webkit.org/show_bug.cgi?id=207360
+        <rdar://problem/57825317>
+
+        Reviewed by Ryosuke Niwa.
+
+        * TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm:
+        (TestWebKitAPI::TEST):
+
 2020-02-13  Said Abou-Hallawa  <[email protected]>
 
         Unreviewed, rolling out r255158, 255405 and r255486

Modified: releases/WebKitGTK/webkit-2.28/Tools/TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm (257418 => 257419)


--- releases/WebKitGTK/webkit-2.28/Tools/TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm	2020-02-26 10:54:43 UTC (rev 257418)
+++ releases/WebKitGTK/webkit-2.28/Tools/TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm	2020-02-26 10:54:52 UTC (rev 257419)
@@ -70,6 +70,13 @@
 
     EXPECT_STREQ("http://site.com", userVisibleString(literalURL("http://site.com")));
     EXPECT_STREQ("http://%77ebsite.com", userVisibleString(literalURL("http://%77ebsite.com")));
+
+    EXPECT_STREQ("-.example.com", [WTF::decodeHostName(@"-.example.com") UTF8String]);
+    EXPECT_STREQ("-a.example.com", [WTF::decodeHostName(@"-a.example.com") UTF8String]);
+    EXPECT_STREQ("a-.example.com", [WTF::decodeHostName(@"a-.example.com") UTF8String]);
+    EXPECT_STREQ("ab--cd.example.com", [WTF::decodeHostName(@"ab--cd.example.com") UTF8String]);
+    EXPECT_STREQ(".example.com", [WTF::decodeHostName(@"xn--.example.com") UTF8String]);
+    EXPECT_STREQ("a..example.com", [WTF::decodeHostName(@"a..example.com") UTF8String]);
 }
     
 TEST(WTF_URLExtras, URLExtras_Spoof)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to