WebKit Bugzilla
Attachment 371068 Details for
Bug 198424
: URLParser::parseIPv6Host should properly parse 0's around compression
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198424-20190531100705.patch (text/plain), 5.26 KB, created by
Alex Christensen
on 2019-05-31 10:07:06 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alex Christensen
Created:
2019-05-31 10:07:06 PDT
Size:
5.26 KB
patch
obsolete
>Index: Source/WTF/ChangeLog >=================================================================== >--- Source/WTF/ChangeLog (revision 245903) >+++ Source/WTF/ChangeLog (working copy) >@@ -1,3 +1,13 @@ >+2019-05-31 Alex Christensen <achristensen@webkit.org> >+ >+ URLParser::parseIPv6Host should properly parse 0's around compression >+ https://bugs.webkit.org/show_bug.cgi?id=198424 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * wtf/URLParser.cpp: >+ (WTF::URLParser::parseIPv6Host): >+ > 2019-04-30 Alan Coon <alancoon@apple.com> > > Cherry-pick r243641. rdar://problem/50232877 >Index: Source/WTF/wtf/URLParser.cpp >=================================================================== >--- Source/WTF/wtf/URLParser.cpp (revision 245903) >+++ Source/WTF/wtf/URLParser.cpp (working copy) >@@ -2408,6 +2408,8 @@ Optional<URLParser::IPv6Address> URLPars > IPv6Address address = {{0, 0, 0, 0, 0, 0, 0, 0}}; > size_t piecePointer = 0; > Optional<size_t> compressPointer; >+ bool previousValueWasZero = false; >+ bool immediatelyAfterCompress = false; > > if (*c == ':') { > advance(c, hostBegin); >@@ -2418,6 +2420,7 @@ Optional<URLParser::IPv6Address> URLPars > advance(c, hostBegin); > ++piecePointer; > compressPointer = piecePointer; >+ immediatelyAfterCompress = true; > } > > while (!c.atEnd()) { >@@ -2429,6 +2432,9 @@ Optional<URLParser::IPv6Address> URLPars > advance(c, hostBegin); > ++piecePointer; > compressPointer = piecePointer; >+ immediatelyAfterCompress = true; >+ if (previousValueWasZero) >+ syntaxViolation(hostBegin); > continue; > } > if (piecePointer == 6 || (compressPointer && piecePointer < 6)) { >@@ -2458,7 +2464,8 @@ Optional<URLParser::IPv6Address> URLPars > advance(c, hostBegin); > } > >- if (UNLIKELY((value && leadingZeros) || (!value && length > 1))) >+ previousValueWasZero = !value; >+ if (UNLIKELY((value && leadingZeros) || (previousValueWasZero && (length > 1 || immediatelyAfterCompress)))) > syntaxViolation(hostBegin); > > address[piecePointer++] = value; >@@ -2467,6 +2474,8 @@ Optional<URLParser::IPv6Address> URLPars > if (piecePointer == 8 || *c != ':') > return WTF::nullopt; > advance(c, hostBegin); >+ >+ immediatelyAfterCompress = false; > } > > if (!c.atEnd()) >Index: Tools/ChangeLog >=================================================================== >--- Tools/ChangeLog (revision 245970) >+++ Tools/ChangeLog (working copy) >@@ -1,3 +1,13 @@ >+2019-05-31 Alex Christensen <achristensen@webkit.org> >+ >+ URLParser::parseIPv6Host should properly parse 0's around compression >+ https://bugs.webkit.org/show_bug.cgi?id=198424 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * TestWebKitAPI/Tests/WTF/URLParser.cpp: >+ (TestWebKitAPI::TEST_F): >+ > 2019-05-30 Kocsen Chung <kocsen_chung@apple.com> > > Apply patch. rdar://problem/50753927 >Index: Tools/TestWebKitAPI/Tests/WTF/URLParser.cpp >=================================================================== >--- Tools/TestWebKitAPI/Tests/WTF/URLParser.cpp (revision 245903) >+++ Tools/TestWebKitAPI/Tests/WTF/URLParser.cpp (working copy) >@@ -230,6 +230,17 @@ TEST_F(WTF_URLParser, Basic) > checkURL("about:blank", {"about", "", "", "", 0, "blank", "", "", "about:blank"}); > checkURL("about:blank?query", {"about", "", "", "", 0, "blank", "query", "", "about:blank?query"}); > checkURL("about:blank#fragment", {"about", "", "", "", 0, "blank", "", "fragment", "about:blank#fragment"}); >+ checkURL("http://[0::0]/", {"http", "", "", "[::]", 0, "/", "", "", "http://[::]/"}); >+ checkURL("http://[0::]/", {"http", "", "", "[::]", 0, "/", "", "", "http://[::]/"}); >+ checkURL("http://[::]/", {"http", "", "", "[::]", 0, "/", "", "", "http://[::]/"}); >+ checkURL("http://[::0]/", {"http", "", "", "[::]", 0, "/", "", "", "http://[::]/"}); >+ checkURL("http://[::0:0]/", {"http", "", "", "[::]", 0, "/", "", "", "http://[::]/"}); >+ checkURL("http://[f::0:0]/", {"http", "", "", "[f::]", 0, "/", "", "", "http://[f::]/"}); >+ checkURL("http://[f:0::f]/", {"http", "", "", "[f::f]", 0, "/", "", "", "http://[f::f]/"}); >+ checkURL("http://[::0:ff]/", {"http", "", "", "[::ff]", 0, "/", "", "", "http://[::ff]/"}); >+ checkURL("http://[::00:0:0:0]/", {"http", "", "", "[::]", 0, "/", "", "", "http://[::]/"}); >+ checkURL("http://[::0:00:0:0]/", {"http", "", "", "[::]", 0, "/", "", "", "http://[::]/"}); >+ checkURL("http://[::0:0.0.0.0]/", {"http", "", "", "[::]", 0, "/", "", "", "http://[::]/"}); > checkURL("http://[0:f::f:f:0:0]", {"http", "", "", "[0:f::f:f:0:0]", 0, "/", "", "", "http://[0:f::f:f:0:0]/"}); > checkURL("http://[0:f:0:0:f::]", {"http", "", "", "[0:f:0:0:f::]", 0, "/", "", "", "http://[0:f:0:0:f::]/"}); > checkURL("http://[::f:0:0:f:0:0]", {"http", "", "", "[::f:0:0:f:0:0]", 0, "/", "", "", "http://[::f:0:0:f:0:0]/"}); >@@ -1225,6 +1236,7 @@ TEST_F(WTF_URLParser, ParserFailures) > shouldFail("http://[a:b:c:d:e:f:127.0.-0.1]"); > shouldFail("asdf://space In\aHost"); > shouldFail("asdf://[0:0:0:0:a:b:c:d"); >+ shouldFail("http://[::0:0.0.00000.0]/"); > } > > // These are in the spec but not in the web platform tests.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
thorton
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 198424
: 371068