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

Unified Diff: ui/gfx/geometry/size.cc

Issue 2354783004: Fix overflow/underflow in gfx geometry once and for all (Closed)
Patch Set: Remove accessibility test changes 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 | « ui/gfx/geometry/safe_integer_conversions_unittest.cc ('k') | ui/gfx/geometry/size_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/geometry/size.cc
diff --git a/ui/gfx/geometry/size.cc b/ui/gfx/geometry/size.cc
index 7cda8e1814cb6139b03ed68d65b07cea5513747e..33f5de17c353d85a2e2136155015cc2910a17c27 100644
--- a/ui/gfx/geometry/size.cc
+++ b/ui/gfx/geometry/size.cc
@@ -15,6 +15,7 @@
#include "base/numerics/safe_math.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
+#include "ui/gfx/geometry/safe_integer_conversions.h"
#include "ui/gfx/geometry/size_conversions.h"
namespace gfx {
@@ -56,7 +57,7 @@ base::CheckedNumeric<int> Size::GetCheckedArea() const {
}
void Size::Enlarge(int grow_width, int grow_height) {
- SetSize(width() + grow_width, height() + grow_height);
+ SetSize(SafeAdd(width(), grow_width), SafeAdd(height(), grow_height));
}
void Size::SetToMin(const Size& other) {
« no previous file with comments | « ui/gfx/geometry/safe_integer_conversions_unittest.cc ('k') | ui/gfx/geometry/size_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698