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

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

Issue 1914693002: Clamp CSS numbers to float range at parsing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 7c51b2eaef72e96480789f22032b1d8ea4b03576..d88aa31cac1b86757677a59777c20023110c4a6a 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp
@@ -83,7 +83,12 @@ static inline bool parseSimpleLength(const CharacterType* characters, unsigned l
// not represent a double.
bool ok;
number = charactersToDouble(characters, length, &ok);
- return ok && CSSPropertyParser::isValidNumericValue(number);
+ if (!std::isfinite(number)) {
rune 2016/04/25 12:24:29 Should this be std::isnan instead?
+ ok = false;
+ } else {
+ number = clampTo<float>(number);
+ }
+ return ok;
}
static CSSValue* parseSimpleLengthValue(CSSPropertyID propertyId, const String& string, CSSParserMode cssParserMode)

Powered by Google App Engine
This is Rietveld 408576698