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

Unified Diff: third_party/WebKit/Source/platform/graphics/Color.cpp

Issue 2404583002: Fix integer overflow in ObjectPainter and divide by zero in Color. (Closed)
Patch Set: Fix two typos converting to saturated. Created 4 years, 2 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/ObjectPainter.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/Color.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/Color.cpp b/third_party/WebKit/Source/platform/graphics/Color.cpp
index 14f8de3133716bb6cf00d3d96ed0b6d7105bc270..3ad2e4d84d59cb85ee67ae9928e4615f93b9b2ee 100644
--- a/third_party/WebKit/Source/platform/graphics/Color.cpp
+++ b/third_party/WebKit/Source/platform/graphics/Color.cpp
@@ -310,7 +310,7 @@ Color Color::dark() const {
getRGBA(r, g, b, a);
float v = std::max(r, std::max(g, b));
- float multiplier = std::max(0.0f, (v - 0.33f) / v);
+ float multiplier = (v == 0.0f) ? 0.0f : std::max(0.0f, (v - 0.33f) / v);
return Color(static_cast<int>(multiplier * r * scaleFactor),
static_cast<int>(multiplier * g * scaleFactor),
« no previous file with comments | « third_party/WebKit/Source/core/paint/ObjectPainter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698