Changeset 206231 in webkit
- Timestamp:
- Sep 21, 2016 1:19:07 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r206230 r206231 1 2016-09-21 Alex Christensen <achristensen@webkit.org> 2 3 URLParser should fail when parsing invalid relative URLs with no schemes 4 https://bugs.webkit.org/show_bug.cgi?id=162355 5 6 Reviewed by Tim Horton. 7 8 Covered by new API tests. 9 10 * platform/URLParser.cpp: 11 (WebCore::copyASCIIStringUntil): 12 When copying from a null String, is8Bit dereferences a null pointer. We don't want to do that. 13 (WebCore::URLParser::parse): 14 What the spec calls a "null" URL matches !url.isValid(), not url.isNull(). 15 The former reflects whether the parsing succeeded, 16 the latter whether the contained String (which could be an invalid URL) is null. 17 1 18 2016-09-21 Antti Koivisto <antti@apple.com> 2 19 -
trunk/Source/WebCore/platform/URLParser.cpp
r206223 r206231 706 706 inline static void copyASCIIStringUntil(Vector<LChar>& destination, const String& string, size_t lengthIf8Bit, size_t lengthIf16Bit) 707 707 { 708 if (string.isNull()) { 709 ASSERT(!lengthIf8Bit); 710 ASSERT(!lengthIf16Bit); 711 return; 712 } 708 713 ASSERT(destination.isEmpty()); 709 714 if (string.is8Bit()) { … … 1070 1075 case State::NoScheme: 1071 1076 LOG_STATE("NoScheme"); 1072 if ( base.isNull() || (base.m_cannotBeABaseURL && *c != '#'))1077 if (!base.isValid() || (base.m_cannotBeABaseURL && *c != '#')) 1073 1078 return failure(input, length); 1074 1079 if (base.m_cannotBeABaseURL && *c == '#') { … … 1241 1246 break; 1242 1247 case '?': 1243 if ( !base.isNull() && base.protocolIs("file"))1248 if (base.isValid() && base.protocolIs("file")) 1244 1249 copyURLPartsUntil(base, URLPart::PathEnd); 1245 1250 m_asciiBuffer.append("///?", 4); … … 1255 1260 break; 1256 1261 case '#': 1257 if ( !base.isNull() && base.protocolIs("file"))1262 if (base.isValid() && base.protocolIs("file")) 1258 1263 copyURLPartsUntil(base, URLPart::QueryEnd); 1259 1264 m_asciiBuffer.append("///#", 4); … … 1270 1275 break; 1271 1276 default: 1272 if ( !base.isNull() && base.protocolIs("file") && shouldCopyFileURL<serialized>(c))1277 if (base.isValid() && base.protocolIs("file") && shouldCopyFileURL<serialized>(c)) 1273 1278 copyURLPartsUntil(base, URLPart::PathAfterLastSlash); 1274 1279 else { … … 1300 1305 break; 1301 1306 } 1302 if ( !base.isNull() && base.protocolIs("file")) {1307 if (base.isValid() && base.protocolIs("file")) { 1303 1308 // FIXME: This String copy is unnecessary. 1304 1309 String basePath = base.path(); … … 1460 1465 case State::SchemeStart: 1461 1466 LOG_FINAL_STATE("SchemeStart"); 1462 if (!m_asciiBuffer.size() && !base.isNull())1467 if (!m_asciiBuffer.size() && base.isValid()) 1463 1468 return base; 1464 1469 return failure(input, length); … … 1545 1550 case State::File: 1546 1551 LOG_FINAL_STATE("File"); 1547 if ( !base.isNull() && base.protocolIs("file")) {1552 if (base.isValid() && base.protocolIs("file")) { 1548 1553 copyURLPartsUntil(base, URLPart::QueryEnd); 1549 1554 m_asciiBuffer.append(':'); … … 2104 2109 } 2105 2110 2106 ASSERT(!serialized || m_hostHasPercentOrNonASCII);2111 ASSERT(!serialized || !m_hostHasPercentOrNonASCII); 2107 2112 if (!m_hostHasPercentOrNonASCII) { 2108 2113 auto hostIterator = iterator; -
trunk/Tools/ChangeLog
r206222 r206231 1 2016-09-21 Alex Christensen <achristensen@webkit.org> 2 3 URLParser should fail when parsing invalid relative URLs with no schemes 4 https://bugs.webkit.org/show_bug.cgi?id=162355 5 6 Reviewed by Tim Horton. 7 8 * TestWebKitAPI/Tests/WebCore/URLParser.cpp: 9 (TestWebKitAPI::TEST_F): 10 1 11 2016-09-21 Keith Miller <keith_miller@apple.com> 2 12 -
trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp
r206220 r206231 312 312 checkRelativeURL("notspecial:/", "http://host", {"notspecial", "", "", "", 0, "/", "", "", "notspecial:/"}); 313 313 checkRelativeURL("foo:/", "http://example.org/foo/bar", {"foo", "", "", "", 0, "/", "", "", "foo:/"}); 314 checkRelativeURL("://:0/", "http://webkit.org/", {"http", "", "", "webkit.org", 0, "/://:0/", "", "", "http://webkit.org/://:0/"}); 314 315 315 316 // The checking of slashes in SpecialAuthoritySlashes needed to get this to pass contradicts what is in the spec, … … 711 712 shouldFail("~", "about:blank"); 712 713 shouldFail("~~~"); 714 shouldFail("://:0/"); 715 shouldFail("://:0/", ""); 716 shouldFail("://:0/", "about:blank"); 713 717 } 714 718
Note: See TracChangeset
for help on using the changeset viewer.