From 80541922e34f2879806caf1bfbd53ebd311f2f87 Mon Sep 17 00:00:00 2001 From: Nick Kralevich Date: Wed, 1 May 2013 14:55:33 -0700 Subject: [PATCH] add strrchr -D_FORTIFY_SOURCE=2 test. Change-Id: I1b95bb0086ae9f2f506f3cc90cee834c0ce3b1d8 --- tests/fortify2_test.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/fortify2_test.cpp b/tests/fortify2_test.cpp index f1a2eb9ea..2e905c5a1 100644 --- a/tests/fortify2_test.cpp +++ b/tests/fortify2_test.cpp @@ -44,6 +44,17 @@ TEST(Fortify2_DeathTest, sprintf_fortified2) { testing::KilledBySignal(SIGSEGV), ""); } +#if __BIONIC__ +TEST(Fortify2_DeathTest, strrchr2) { + ::testing::FLAGS_gtest_death_test_style = "threadsafe"; + foo myfoo; + memcpy(myfoo.a, "0123456789", 10); + memcpy(myfoo.b, "01234", 6); + ASSERT_EXIT(printf("%s", strrchr(myfoo.a, 'a')), + testing::KilledBySignal(SIGSEGV), ""); +} +#endif + /***********************************************************/ /* TESTS BELOW HERE DUPLICATE TESTS FROM fortify1_test.cpp */ /***********************************************************/