Index: third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp |
diff --git a/third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp b/third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp |
index f1af2cb4321e092b42b380458087a50be2a7f407..d098d3f09a1b49a97e83f4dcf1e7183259be5ad6 100644 |
--- a/third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp |
+++ b/third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp |
@@ -42,7 +42,6 @@ static bool genericParseNumber(const CharType*& ptr, const CharType* end, FloatT |
{ |
FloatType integer, decimal, frac, exponent; |
int sign, expsign; |
- const CharType* start = ptr; |
exponent = 0; |
integer = 0; |
@@ -67,14 +66,14 @@ static bool genericParseNumber(const CharType*& ptr, const CharType* end, FloatT |
return false; |
// read the integer part, build right-to-left |
- const CharType* ptrStartIntPart = ptr; |
+ const CharType* digitsStart = ptr; |
while (ptr < end && *ptr >= '0' && *ptr <= '9') |
++ptr; // Advance to first non-digit. |
- if (ptr != ptrStartIntPart) { |
+ if (ptr != digitsStart) { |
const CharType* ptrScanIntPart = ptr - 1; |
FloatType multiplier = 1; |
- while (ptrScanIntPart >= ptrStartIntPart) { |
+ while (ptrScanIntPart >= digitsStart) { |
integer += multiplier * static_cast<FloatType>(*(ptrScanIntPart--) - '0'); |
multiplier *= 10; |
} |
@@ -94,8 +93,12 @@ static bool genericParseNumber(const CharType*& ptr, const CharType* end, FloatT |
decimal += (*(ptr++) - '0') * (frac *= static_cast<FloatType>(0.1)); |
} |
+ // When we get here we should have consumed either a digit for the integer |
+ // part or a fractional part (with at least one digit after the '.'.) |
+ ASSERT(digitsStart != ptr); |
+ |
// read the exponent part |
- if (ptr != start && ptr + 1 < end && (*ptr == 'e' || *ptr == 'E') |
+ if (ptr + 1 < end && (*ptr == 'e' || *ptr == 'E') |
&& (ptr[1] != 'x' && ptr[1] != 'm')) { |
ptr++; |
@@ -131,9 +134,6 @@ static bool genericParseNumber(const CharType*& ptr, const CharType* end, FloatT |
if (!isValidRange(number)) |
return false; |
- if (start == ptr) |
- return false; |
- |
if (mode & AllowTrailingWhitespace) |
skipOptionalSVGSpacesOrDelimiter(ptr, end); |