Title: [256629] trunk
- Revision
- 256629
- Author
- [email protected]
- Date
- 2020-02-14 11:09:32 -0800 (Fri, 14 Feb 2020)
Log Message
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: trunk/Source/WTF/ChangeLog (256628 => 256629)
--- trunk/Source/WTF/ChangeLog 2020-02-14 19:05:47 UTC (rev 256628)
+++ trunk/Source/WTF/ChangeLog 2020-02-14 19:09:32 UTC (rev 256629)
@@ -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 Said Abou-Hallawa <[email protected]>
WebP image format is not supported
Modified: trunk/Source/WTF/wtf/URLHelpers.cpp (256628 => 256629)
--- trunk/Source/WTF/wtf/URLHelpers.cpp 2020-02-14 19:05:47 UTC (rev 256628)
+++ trunk/Source/WTF/wtf/URLHelpers.cpp 2020-02-14 19:09:32 UTC (rev 256629)
@@ -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: trunk/Tools/ChangeLog (256628 => 256629)
--- trunk/Tools/ChangeLog 2020-02-14 19:05:47 UTC (rev 256628)
+++ trunk/Tools/ChangeLog 2020-02-14 19:09:32 UTC (rev 256629)
@@ -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-14 Don Olmstead <[email protected]>
[CMake] Add Fontconfig::Fontconfig target
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm (256628 => 256629)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm 2020-02-14 19:05:47 UTC (rev 256628)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm 2020-02-14 19:09:32 UTC (rev 256629)
@@ -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