aboutsummaryrefslogtreecommitdiffstats
path: root/tests/fortify_test.cpp
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2015-04-16 09:07:45 -0400
committerDaniel Micay <danielmicay@gmail.com>2015-04-16 10:33:35 -0400
commite7e1c875b0f8eefb1d771f200a58f54e64c39d55 (patch)
treef6f7d5465c32d2dc7144c9e46b8b57da480f8528 /tests/fortify_test.cpp
parenta40cb0ca7fe8ddc146831e92ec543be9feb26a65 (diff)
downloadandroid_bionic-e7e1c875b0f8eefb1d771f200a58f54e64c39d55.tar.gz
android_bionic-e7e1c875b0f8eefb1d771f200a58f54e64c39d55.tar.bz2
android_bionic-e7e1c875b0f8eefb1d771f200a58f54e64c39d55.zip
add fortified implementations of pread/pread64
Change-Id: Iec39c3917e0bc94371bd81541619392f5abe29b9
Diffstat (limited to 'tests/fortify_test.cpp')
-rw-r--r--tests/fortify_test.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/fortify_test.cpp b/tests/fortify_test.cpp
index 5cc728f29..70159de3c 100644
--- a/tests/fortify_test.cpp
+++ b/tests/fortify_test.cpp
@@ -623,6 +623,22 @@ TEST_F(DEATHTEST, FD_ISSET_2_fortified) {
ASSERT_FORTIFY(FD_ISSET(0, set));
}
+TEST_F(DEATHTEST, pread_fortified) {
+ char buf[1];
+ size_t ct = atoi("2"); // prevent optimizations
+ int fd = open("/dev/null", O_RDONLY);
+ ASSERT_FORTIFY(pread(fd, buf, ct, 0));
+ close(fd);
+}
+
+TEST_F(DEATHTEST, pread64_fortified) {
+ char buf[1];
+ size_t ct = atoi("2"); // prevent optimizations
+ int fd = open("/dev/null", O_RDONLY);
+ ASSERT_FORTIFY(pread64(fd, buf, ct, 0));
+ close(fd);
+}
+
TEST_F(DEATHTEST, read_fortified) {
char buf[1];
size_t ct = atoi("2"); // prevent optimizations