Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Unified Diff: third_party/WebKit/Source/core/html/parser/HTMLParserIdioms.cpp

Issue 1694773002: Check length of String before checking if it's 8/16 bit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add CORE_EXPORT Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/parser/HTMLParserIdioms.cpp
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLParserIdioms.cpp b/third_party/WebKit/Source/core/html/parser/HTMLParserIdioms.cpp
index 640803f4736174d7f6638635be4cb33bf3faf834..4d8b2c2b1385de9fc4ca9f9c09efd5a266e2a664 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLParserIdioms.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLParserIdioms.cpp
@@ -309,9 +309,10 @@ static Vector<double> parseHTMLListOfFloatingPointNumbersInternal(
// https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-a-list-of-floating-point-numbers
Vector<double> parseHTMLListOfFloatingPointNumbers(const String& input)
{
- if (input.is8Bit())
- return parseHTMLListOfFloatingPointNumbersInternal(input.characters8(), input.characters8() + input.length());
- return parseHTMLListOfFloatingPointNumbersInternal(input.characters16(), input.characters16() + input.length());
+ unsigned length = input.length();
+ if (!length || input.is8Bit())
+ return parseHTMLListOfFloatingPointNumbersInternal(input.characters8(), input.characters8() + length);
+ return parseHTMLListOfFloatingPointNumbersInternal(input.characters16(), input.characters16() + length);
}
static const char charsetString[] = "charset";

Powered by Google App Engine
This is Rietveld 408576698