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

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp

Issue 2115923002: Improve numeric value handling in CSS Parser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: V2 Created 4 years, 5 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/css/parser/CSSParserFastPaths.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp b/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp
index 354b483ef52385ddbad04dfb8523aac5b67b97c0..1bb13ac6abfcce448c0137216444ebb5ffb74e89 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp
@@ -87,7 +87,10 @@ static inline bool parseSimpleLength(const CharacterType* characters, unsigned l
// not represent a double.
bool ok;
number = charactersToDouble(characters, length, &ok);
- return ok && CSSParserToken::isValidNumericValue(number);
+ if (!ok)
+ return false;
+ number = clampTo<double>(number, -std::numeric_limits<float>::max(), std::numeric_limits<float>::max());
+ return true;
}
static CSSValue* parseSimpleLengthValue(CSSPropertyID propertyId, const String& string, CSSParserMode cssParserMode)

Powered by Google App Engine
This is Rietveld 408576698