summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2013-10-03 14:08:39 -0700
committerNick Kralevich <nnk@google.com>2013-10-03 15:45:10 -0700
commit7943df62f70f686b0c77532f6617b47255d75763 (patch)
tree13dfe2af815383802fe91f3192f4573ac13eb210 /tests
parent6088047a64abb1e8a27fcb9868b00a630fbdfed4 (diff)
downloadbionic-7943df62f70f686b0c77532f6617b47255d75763.zip
bionic-7943df62f70f686b0c77532f6617b47255d75763.tar.gz
bionic-7943df62f70f686b0c77532f6617b47255d75763.tar.bz2
Check memory size on FD_* functions
Make sure the buffer we're dealing with has enough room. Might as well check for memory issues while we're here, even though I don't imagine they'll happen in practice. Change-Id: I0ae1f0f06aca9ceb91e58c70183bb14e275b92b5
Diffstat (limited to 'tests')
-rw-r--r--tests/fortify_test.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/fortify_test.cpp b/tests/fortify_test.cpp
index abe2cae..d514a3d 100644
--- a/tests/fortify_test.cpp
+++ b/tests/fortify_test.cpp
@@ -554,6 +554,20 @@ TEST(DEATHTEST, FD_ISSET_fortified) {
ASSERT_EXIT(FD_ISSET(-1, &set), testing::KilledBySignal(SIGABRT), "");
}
+TEST(DEATHTEST, FD_ISSET_2_fortified) {
+ ::testing::FLAGS_gtest_death_test_style = "threadsafe";
+ char buf[1];
+ fd_set* set = (fd_set*) buf;
+ ASSERT_EXIT(FD_ISSET(0, set), testing::KilledBySignal(SIGABRT), "");
+}
+
+TEST(DEATHTEST, FD_ZERO_fortified) {
+ ::testing::FLAGS_gtest_death_test_style = "threadsafe";
+ char buf[1];
+ fd_set* set = (fd_set*) buf;
+ ASSERT_EXIT(FD_ZERO(set), testing::KilledBySignal(SIGABRT), "");
+}
+
extern "C" char* __strncat_chk(char*, const char*, size_t, size_t);
extern "C" char* __strcat_chk(char*, const char*, size_t);