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

Unified Diff: third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp

Issue 2597103002: Prevent floating point overflow when using calc() with large values (Closed)
Patch Set: Bigger numbers Created 4 years 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/resolver/StyleBuilderConverter.cpp
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
index d1ae57fd2811dd9d2ea429c296c1cc852c959ff1..bff57a8fcd82df3034bf6cafaf8bafefe011ca87 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
@@ -850,8 +850,10 @@ Length StyleBuilderConverter::convertLineHeight(StyleResolverState& state,
100.0,
Fixed);
}
- if (primitiveValue.isNumber())
- return Length(primitiveValue.getDoubleValue() * 100.0, Percent);
+ if (primitiveValue.isNumber()) {
+ return Length(clampTo<float>(primitiveValue.getDoubleValue() * 100.0),
+ Percent);
+ }
if (primitiveValue.isCalculated()) {
Length zoomedLength = Length(primitiveValue.cssCalcValue()->toCalcValue(
lineHeightToLengthConversionData(state)));

Powered by Google App Engine
This is Rietveld 408576698