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

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSParserToken.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/CSSParserToken.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserToken.cpp b/third_party/WebKit/Source/core/css/parser/CSSParserToken.cpp
index 51014658dd27281ffba820e298957ff4838f9008..94484091f7473b8c0f524ce5216a4705999134dd 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSParserToken.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSParserToken.cpp
@@ -41,8 +41,12 @@ CSSParserToken::CSSParserToken(CSSParserTokenType type, double numericValue, Num
, m_numericValueType(numericValueType)
, m_numericSign(sign)
, m_unit(static_cast<unsigned>(CSSPrimitiveValue::UnitType::Number))
- , m_numericValue(numericValue)
{
+ if (!std::isfinite(numericValue)) {
+ m_numericValue = 0.0;
rune 2016/04/25 12:24:29 Shouldn't +/-inf be clamped too? Why is 0 a good
+ } else {
+ m_numericValue = clampTo<float>(numericValue);
+ }
ASSERT(type == NumberToken);
}

Powered by Google App Engine
This is Rietveld 408576698