summaryrefslogtreecommitdiffstats
path: root/linker
diff options
context:
space:
mode:
authorDmitriy Ivanov <dimitry@google.com>2015-06-08 10:41:33 -0700
committerDmitriy Ivanov <dimitry@google.com>2015-06-10 15:25:48 -0700
commit07f4f5f9edc33d22c41f51224f8be0c0a51e5b6b (patch)
treea13eb81ddc7fe974516e0819242d5f17b461967e /linker
parent511cfd9dc8cb41bca4920687c7d816ee916ee8e5 (diff)
downloadbionic-07f4f5f9edc33d22c41f51224f8be0c0a51e5b6b.zip
bionic-07f4f5f9edc33d22c41f51224f8be0c0a51e5b6b.tar.gz
bionic-07f4f5f9edc33d22c41f51224f8be0c0a51e5b6b.tar.bz2
Check if strtab exists before using it
Bug: http://b/21696087 Change-Id: I1e22d5fd6fe2faead332249493123c9a085081e9 (cherry picked from commit 624b8f17a1ce9b968f11e73231733442a07ac001)
Diffstat (limited to 'linker')
-rw-r--r--linker/linker.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 5aabacc..bdd3ecd 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -2857,17 +2857,6 @@ bool soinfo::prelink_image() {
}
}
- // second pass - parse entries relying on strtab
- for (ElfW(Dyn)* d = dynamic; d->d_tag != DT_NULL; ++d) {
- if (d->d_tag == DT_SONAME) {
- soname_ = get_string(d->d_un.d_val);
-#if defined(__work_around_b_19059885__)
- strlcpy(old_name_, soname_, sizeof(old_name_));
-#endif
- break;
- }
- }
-
DEBUG("si->base = %p, si->strtab = %p, si->symtab = %p",
reinterpret_cast<void*>(base), strtab_, symtab_);
@@ -2890,6 +2879,17 @@ bool soinfo::prelink_image() {
return false;
}
+ // second pass - parse entries relying on strtab
+ for (ElfW(Dyn)* d = dynamic; d->d_tag != DT_NULL; ++d) {
+ if (d->d_tag == DT_SONAME) {
+ soname_ = get_string(d->d_un.d_val);
+#if defined(__work_around_b_19059885__)
+ strlcpy(old_name_, soname_, sizeof(old_name_));
+#endif
+ break;
+ }
+ }
+
// Before M release linker was using basename in place of soname.
// In the case when dt_soname is absent some apps stop working
// because they can't find dt_needed library by soname.