Title: [206615] trunk/Source/WebCore
- Revision
- 206615
- Author
- [email protected]
- Date
- 2016-09-29 14:25:14 -0700 (Thu, 29 Sep 2016)
Log Message
URLParser should correctly parse ports with leading 0's
https://bugs.webkit.org/show_bug.cgi?id=162752
* platform/URLParser.cpp:
(WebCore::URLParser::parsePort):
Followup. Remove branches based on Geoffrey's feedback.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (206614 => 206615)
--- trunk/Source/WebCore/ChangeLog 2016-09-29 21:20:43 UTC (rev 206614)
+++ trunk/Source/WebCore/ChangeLog 2016-09-29 21:25:14 UTC (rev 206615)
@@ -3,6 +3,15 @@
URLParser should correctly parse ports with leading 0's
https://bugs.webkit.org/show_bug.cgi?id=162752
+ * platform/URLParser.cpp:
+ (WebCore::URLParser::parsePort):
+ Followup. Remove branches based on Geoffrey's feedback.
+
+2016-09-29 Alex Christensen <[email protected]>
+
+ URLParser should correctly parse ports with leading 0's
+ https://bugs.webkit.org/show_bug.cgi?id=162752
+
Reviewed by Tim Horton.
Covered by new API tests.
Modified: trunk/Source/WebCore/platform/URLParser.cpp (206614 => 206615)
--- trunk/Source/WebCore/platform/URLParser.cpp 2016-09-29 21:20:43 UTC (rev 206614)
+++ trunk/Source/WebCore/platform/URLParser.cpp 2016-09-29 21:25:14 UTC (rev 206615)
@@ -2361,8 +2361,7 @@
syntaxViolation(colonIterator);
return true;
}
- bool seenDigit = false;
- bool seenMultipleDigits = false;
+ size_t digitCount = 0;
bool leadingZeros = false;
for (; !iterator.atEnd(); ++iterator) {
if (UNLIKELY(isTabOrNewline(*iterator))) {
@@ -2370,11 +2369,9 @@
continue;
}
if (isASCIIDigit(*iterator)) {
- if (*iterator == '0' && !seenDigit)
+ if (*iterator == '0' && !digitCount)
leadingZeros = true;
- if (seenDigit)
- seenMultipleDigits = true;
- seenDigit = true;
+ ++digitCount;
port = port * 10 + *iterator - '0';
if (port > std::numeric_limits<uint16_t>::max())
return false;
@@ -2385,7 +2382,7 @@
if (port && leadingZeros)
syntaxViolation(colonIterator);
- if (!port && seenMultipleDigits)
+ if (!port && digitCount > 1)
syntaxViolation(colonIterator);
if (UNLIKELY(isDefaultPort(parsedDataView(0, m_url.m_schemeEnd), port)))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes