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

Unified Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 2231623002: Prevent integer overflow in ComputedStyle::outlineOutsetExtent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added layout test Created 4 years, 4 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/LayoutTests/fast/css/outline-offset-large-expected.html ('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/core/style/ComputedStyle.cpp
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.cpp b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
index 984ff42be192101a07c21c53955cd3c42a23b460..5e872511887bd9616f8627a8150dd4a5e951b1da 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
@@ -52,6 +52,7 @@
#include "platform/transforms/TranslateTransformOperation.h"
#include "wtf/MathExtras.h"
#include "wtf/PtrUtil.h"
+#include "wtf/SaturatedArithmetic.h"
#include <algorithm>
#include <memory>
@@ -1784,7 +1785,7 @@ int ComputedStyle::outlineOutsetExtent() const
return 0;
if (outlineStyleIsAuto())
return GraphicsContext::focusRingOutsetExtent(outlineOffset(), outlineWidth());
- return std::max(0, outlineWidth() + outlineOffset());
+ return std::max(0, saturatedAddition(outlineWidth(), outlineOffset()));
}
bool ComputedStyle::columnRuleEquivalent(const ComputedStyle* otherStyle) const
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css/outline-offset-large-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698