aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dlfcn_test.cpp
diff options
context:
space:
mode:
authorDimitry Ivanov <dimitry@google.com>2016-08-15 14:06:04 -0700
committerDimitry Ivanov <dimitry@google.com>2016-08-15 14:06:04 -0700
commit559583469cd6425cdf3f63bcfc453d7d885ce131 (patch)
treeb4f97018d077943756709fbcb2738ebfffe59250 /tests/dlfcn_test.cpp
parent46230445172d3cd72c38102d57f5a1b725c80367 (diff)
downloadandroid_bionic-559583469cd6425cdf3f63bcfc453d7d885ce131.tar.gz
android_bionic-559583469cd6425cdf3f63bcfc453d7d885ce131.tar.bz2
android_bionic-559583469cd6425cdf3f63bcfc453d7d885ce131.zip
linker: add test for zeroed out shdr_table_
Bug: http://b/30795430 Change-Id: I86b658d01b64670d3e702ddb1d3f9db4f75d784f Test: bionic-unit-tests --gtest_filter=dlfcn.dlopen_invalid*
Diffstat (limited to 'tests/dlfcn_test.cpp')
-rw-r--r--tests/dlfcn_test.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp
index 0fa32b3d4..f474ed9ed 100644
--- a/tests/dlfcn_test.cpp
+++ b/tests/dlfcn_test.cpp
@@ -1202,4 +1202,12 @@ TEST(dlfcn, dlopen_invalid_zero_shdr_table_offset) {
ASSERT_SUBSTR(expected_dlerror.c_str(), dlerror());
}
+TEST(dlfcn, dlopen_invalid_zero_shdr_table_content) {
+ std::string libpath = std::string(getenv("ANDROID_DATA")) + PREBUILT_ELF_PATH + "/libtest_invalid-zero_shdr_table_content.so";
+ void* handle = dlopen(libpath.c_str(), RTLD_NOW);
+ ASSERT_TRUE(handle == nullptr);
+ std::string expected_dlerror = std::string("dlopen failed: \"") + libpath + "\" .dynamic section header was not found";
+ ASSERT_SUBSTR(expected_dlerror.c_str(), dlerror());
+}
+
#endif