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

Unified Diff: third_party/WebKit/Source/platform/LayoutUnitTest.cpp

Issue 2160983007: Avoid integer overflow in LayoutUnit's unary minus operator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/platform/LayoutUnit.h ('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/LayoutUnitTest.cpp
diff --git a/third_party/WebKit/Source/platform/LayoutUnitTest.cpp b/third_party/WebKit/Source/platform/LayoutUnitTest.cpp
index 61818cb504c516d24e11d6582b1c949bdfca04f9..44e774758b4582b365e6268a3edb4b39493f62dd 100644
--- a/third_party/WebKit/Source/platform/LayoutUnitTest.cpp
+++ b/third_party/WebKit/Source/platform/LayoutUnitTest.cpp
@@ -256,4 +256,9 @@ TEST(LayoutUnitTest, LayoutUnitFloatOverflow)
EXPECT_EQ(intMinForLayoutUnit, LayoutUnit(-176972000.0).toInt());
}
+TEST(LayoutUnitTest, UnaryMinusSaturated)
pdr. 2016/07/20 21:03:55 What about -(LayoutUnit::min + 1)?
Xianzhu 2016/07/20 21:09:10 This won't be saturated, just a normal negative.
Xianzhu 2016/07/20 21:19:20 Converted this test case to a full UnaryMinus case
+{
+ EXPECT_EQ(LayoutUnit::max(), -LayoutUnit::min());
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/platform/LayoutUnit.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698