⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 245983 in webkit


Ignore:
Timestamp:
May 31, 2019, 1:56:40 PM (7 years ago)
Author:
achristensen@apple.com
Message:

URLParser::parseIPv6Host should properly parse 0's around compression
https://bugs.webkit.org/show_bug.cgi?id=198424

Reviewed by Tim Horton.

Source/WTF:

  • wtf/URLParser.cpp:

(WTF::URLParser::parseIPv6Host):

Tools:

  • TestWebKitAPI/Tests/WTF/URLParser.cpp:

(TestWebKitAPI::TEST_F):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r245982 r245983  
     12019-05-31  Alex Christensen  <achristensen@webkit.org>
     2
     3        URLParser::parseIPv6Host should properly parse 0's around compression
     4        https://bugs.webkit.org/show_bug.cgi?id=198424
     5
     6        Reviewed by Tim Horton.
     7
     8        * wtf/URLParser.cpp:
     9        (WTF::URLParser::parseIPv6Host):
     10
    1112019-05-31  Alex Christensen  <achristensen@webkit.org>
    212
  • trunk/Source/WTF/wtf/URLParser.cpp

    r245982 r245983  
    24022402    size_t piecePointer = 0;
    24032403    Optional<size_t> compressPointer;
     2404    bool previousValueWasZero = false;
     2405    bool immediatelyAfterCompress = false;
    24042406
    24052407    if (*c == ':') {
     
    24122414        ++piecePointer;
    24132415        compressPointer = piecePointer;
     2416        immediatelyAfterCompress = true;
    24142417    }
    24152418   
     
    24232426            ++piecePointer;
    24242427            compressPointer = piecePointer;
     2428            immediatelyAfterCompress = true;
     2429            if (previousValueWasZero)
     2430                syntaxViolation(hostBegin);
    24252431            continue;
    24262432        }
     
    24522458        }
    24532459       
    2454         if (UNLIKELY((value && leadingZeros) || (!value && length > 1)))
     2460        previousValueWasZero = !value;
     2461        if (UNLIKELY((value && leadingZeros) || (previousValueWasZero && (length > 1 || immediatelyAfterCompress))))
    24552462            syntaxViolation(hostBegin);
    24562463
     
    24612468            return WTF::nullopt;
    24622469        advance(c, hostBegin);
     2470
     2471        immediatelyAfterCompress = false;
    24632472    }
    24642473   
  • trunk/Tools/ChangeLog

    r245982 r245983  
     12019-05-31  Alex Christensen  <achristensen@webkit.org>
     2
     3        URLParser::parseIPv6Host should properly parse 0's around compression
     4        https://bugs.webkit.org/show_bug.cgi?id=198424
     5
     6        Reviewed by Tim Horton.
     7
     8        * TestWebKitAPI/Tests/WTF/URLParser.cpp:
     9        (TestWebKitAPI::TEST_F):
     10
    1112019-05-31  Alex Christensen  <achristensen@webkit.org>
    212
  • trunk/Tools/TestWebKitAPI/Tests/WTF/URLParser.cpp

    r245982 r245983  
    231231    checkURL("about:blank?query", {"about", "", "", "", 0, "blank", "query", "", "about:blank?query"});
    232232    checkURL("about:blank#fragment", {"about", "", "", "", 0, "blank", "", "fragment", "about:blank#fragment"});
     233    checkURL("http://[0::0]/", {"http", "", "", "[::]", 0, "/", "", "", "http://[::]/"});
     234    checkURL("http://[0::]/", {"http", "", "", "[::]", 0, "/", "", "", "http://[::]/"});
     235    checkURL("http://[::]/", {"http", "", "", "[::]", 0, "/", "", "", "http://[::]/"});
     236    checkURL("http://[::0]/", {"http", "", "", "[::]", 0, "/", "", "", "http://[::]/"});
     237    checkURL("http://[::0:0]/", {"http", "", "", "[::]", 0, "/", "", "", "http://[::]/"});
     238    checkURL("http://[f::0:0]/", {"http", "", "", "[f::]", 0, "/", "", "", "http://[f::]/"});
     239    checkURL("http://[f:0::f]/", {"http", "", "", "[f::f]", 0, "/", "", "", "http://[f::f]/"});
     240    checkURL("http://[::0:ff]/", {"http", "", "", "[::ff]", 0, "/", "", "", "http://[::ff]/"});
     241    checkURL("http://[::00:0:0:0]/", {"http", "", "", "[::]", 0, "/", "", "", "http://[::]/"});
     242    checkURL("http://[::0:00:0:0]/", {"http", "", "", "[::]", 0, "/", "", "", "http://[::]/"});
     243    checkURL("http://[::0:0.0.0.0]/", {"http", "", "", "[::]", 0, "/", "", "", "http://[::]/"});
    233244    checkURL("http://[0:f::f:f:0:0]", {"http", "", "", "[0:f::f:f:0:0]", 0, "/", "", "", "http://[0:f::f:f:0:0]/"});
    234245    checkURL("http://[0:f:0:0:f::]", {"http", "", "", "[0:f:0:0:f::]", 0, "/", "", "", "http://[0:f:0:0:f::]/"});
     
    12291240    shouldFail("asdf://space In\aHost");
    12301241    shouldFail("asdf://[0:0:0:0:a:b:c:d");
     1242    shouldFail("http://[::0:0.0.00000.0]/");
    12311243}
    12321244
Note: See TracChangeset for help on using the changeset viewer.