Title: [247269] trunk
Revision
247269
Author
[email protected]
Date
2019-07-09 12:15:04 -0700 (Tue, 09 Jul 2019)

Log Message

When parsing an IPv4 address, wait until after deciding it is indeed an IPv4 address before reporting syntax violations
https://bugs.webkit.org/show_bug.cgi?id=199628

Reviewed by Brady Eidson.

Source/WTF:

Otherwise, we sometimes report syntax violations on things that are not IPv4 addresses and don't have syntax violations.
I added a unit test with one such URL that used to cause an assertion.

* wtf/URLParser.cpp:
(WTF::URLParser::parseIPv4Host):

Tools:

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

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (247268 => 247269)


--- trunk/Source/WTF/ChangeLog	2019-07-09 19:13:52 UTC (rev 247268)
+++ trunk/Source/WTF/ChangeLog	2019-07-09 19:15:04 UTC (rev 247269)
@@ -1,5 +1,18 @@
 2019-07-09  Alex Christensen  <[email protected]>
 
+        When parsing an IPv4 address, wait until after deciding it is indeed an IPv4 address before reporting syntax violations
+        https://bugs.webkit.org/show_bug.cgi?id=199628
+
+        Reviewed by Brady Eidson.
+
+        Otherwise, we sometimes report syntax violations on things that are not IPv4 addresses and don't have syntax violations.
+        I added a unit test with one such URL that used to cause an assertion.
+
+        * wtf/URLParser.cpp:
+        (WTF::URLParser::parseIPv4Host):
+
+2019-07-09  Alex Christensen  <[email protected]>
+
         Remove invalid assertion in URLParser::domainToASCII
         https://bugs.webkit.org/show_bug.cgi?id=199624
 

Modified: trunk/Source/WTF/wtf/URLParser.cpp (247268 => 247269)


--- trunk/Source/WTF/wtf/URLParser.cpp	2019-07-09 19:13:52 UTC (rev 247268)
+++ trunk/Source/WTF/wtf/URLParser.cpp	2019-07-09 19:15:04 UTC (rev 247269)
@@ -2294,7 +2294,7 @@
         if (!iterator.atEnd() && *iterator == '.') {
             ++iterator;
             if (iterator.atEnd())
-                syntaxViolation(iteratorForSyntaxViolationPosition);
+                didSeeSyntaxViolation = true;
             else if (*iterator == '.')
                 return makeUnexpected(IPv4ParsingError::NotIPv4);
         }

Modified: trunk/Tools/ChangeLog (247268 => 247269)


--- trunk/Tools/ChangeLog	2019-07-09 19:13:52 UTC (rev 247268)
+++ trunk/Tools/ChangeLog	2019-07-09 19:15:04 UTC (rev 247269)
@@ -1,5 +1,15 @@
 2019-07-09  Alex Christensen  <[email protected]>
 
+        When parsing an IPv4 address, wait until after deciding it is indeed an IPv4 address before reporting syntax violations
+        https://bugs.webkit.org/show_bug.cgi?id=199628
+
+        Reviewed by Brady Eidson.
+
+        * TestWebKitAPI/Tests/WTF/URLParser.cpp:
+        (TestWebKitAPI::TEST_F):
+
+2019-07-09  Alex Christensen  <[email protected]>
+
         Remove invalid assertion in URLParser::domainToASCII
         https://bugs.webkit.org/show_bug.cgi?id=199624
 

Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/URLParser.cpp (247268 => 247269)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/URLParser.cpp	2019-07-09 19:13:52 UTC (rev 247268)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/URLParser.cpp	2019-07-09 19:15:04 UTC (rev 247269)
@@ -345,6 +345,7 @@
     checkURL("http://127.0.0.1:/\tpath", {"http", "", "", "127.0.0.1", 0, "/path", "", "", "http://127.0.0.1/path"});
     checkURL("http://127.0.0.1:123", {"http", "", "", "127.0.0.1", 123, "/", "", "", "http://127.0.0.1:123/"});
     checkURL("http://127.0.0.1:", {"http", "", "", "127.0.0.1", 0, "/", "", "", "http://127.0.0.1/"});
+    checkURL("ws://08./", {"ws", "", "", "08.", 0, "/", "", "", "ws://08./"});
     checkURL("http://[0:f::f:f:0:0]:123/path", {"http", "", "", "[0:f::f:f:0:0]", 123, "/path", "", "", "http://[0:f::f:f:0:0]:123/path"});
     checkURL("http://[0:f::f:f:0:0]:123", {"http", "", "", "[0:f::f:f:0:0]", 123, "/", "", "", "http://[0:f::f:f:0:0]:123/"});
     checkURL("http://[0:f:0:0:f:\t:]:123", {"http", "", "", "[0:f:0:0:f::]", 123, "/", "", "", "http://[0:f:0:0:f::]:123/"});
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to