Add trivial test for __memrchr_chk.
Bug: N/A
Test: ran tests
Change-Id: I42aefcbf1fac6b96e56a0e21f94586a3caa524dc
diff --git a/tests/fortify_test.cpp b/tests/fortify_test.cpp
index 2946e23..67c124d 100644
--- a/tests/fortify_test.cpp
+++ b/tests/fortify_test.cpp
@@ -219,6 +219,18 @@
#endif // __BIONIC__
}
+TEST_F(DEATHTEST, memrchr_fortified2) {
+#if defined(__BIONIC__)
+ foo myfoo;
+ volatile int asize = sizeof(myfoo.a) + 1;
+ memcpy(myfoo.a, "0123456789", sizeof(myfoo.a));
+ ASSERT_FORTIFY(printf("%s", memrchr(myfoo.a, 'a', asize)));
+ ASSERT_FORTIFY(printf("%s", memrchr(static_cast<const void*>(myfoo.a), 'a', asize)));
+#else // __BIONIC__
+ GTEST_LOG_(INFO) << "This test does nothing.\n";
+#endif // __BIONIC__
+}
+
TEST_F(DEATHTEST, strlcpy_fortified2) {
#if defined(__BIONIC__)
foo myfoo;