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

Unified Diff: base/tools_sanity_unittest.cc

Issue 1264053002: CFI: Add a death test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build config Created 5 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 | « no previous file | build/common.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/tools_sanity_unittest.cc
diff --git a/base/tools_sanity_unittest.cc b/base/tools_sanity_unittest.cc
index c0541d139fb48b22c3425b02de90b10dedff7017..4340fcd9ba53a56739f71c936553893c7af423ef 100644
--- a/base/tools_sanity_unittest.cc
+++ b/base/tools_sanity_unittest.cc
@@ -339,4 +339,19 @@ TEST(ToolsSanityTest, AtomicsAreIgnored) {
EXPECT_EQ(kMagicValue, shared);
}
+#if defined(CFI_ENFORCEMENT)
+TEST(ToolsSanityTest, BadCast) {
+ class A {
+ virtual void f() {}
+ };
+
+ class B {
+ virtual void f() {}
+ };
+
+ A a;
+ EXPECT_DEATH((void)(B*)&a, "ILL_ILLOPN");
+}
+#endif
+
} // namespace base
« no previous file with comments | « no previous file | build/common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698