summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2017-04-05 21:29:38 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2017-04-05 21:29:38 +0000
commit5c18b4406e11d89345e278457f7dbbe2f6af9cee (patch)
treea22a0d0ddff5ab651343f78d5a10008990abfe0e
parentf2dc4362c002d77da87bbcd0a6351504da825de7 (diff)
downloadbcm5719-llvm-5c18b4406e11d89345e278457f7dbbe2f6af9cee.tar.gz
bcm5719-llvm-5c18b4406e11d89345e278457f7dbbe2f6af9cee.zip
AddressSpace: fix DWARF based unwinding handling on Android
It is possible that there are no program headers in the module. Do not attempt to dereference nullptr as a program header. llvm-svn: 299591
-rw-r--r--libunwind/src/AddressSpace.hpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/libunwind/src/AddressSpace.hpp b/libunwind/src/AddressSpace.hpp
index ab6e0d574fc..54b258ed283 100644
--- a/libunwind/src/AddressSpace.hpp
+++ b/libunwind/src/AddressSpace.hpp
@@ -394,8 +394,11 @@ inline bool LocalAddressSpace::findUnwindSections(pint_t targetAddr,
size_t object_length;
#if defined(__ANDROID__)
Elf_Addr image_base =
- reinterpret_cast<Elf_Addr>(pinfo->dlpi_phdr) -
- reinterpret_cast<const Elf_Phdr *>(pinfo->dlpi_phdr)->p_offset;
+ pinfo->dlpi_phnum
+ ? reinterpret_cast<Elf_Addr>(pinfo->dlpi_phdr) -
+ reinterpret_cast<const Elf_Phdr *>(pinfo->dlpi_phdr)
+ ->p_offset
+ : 0;
#endif
for (Elf_Half i = 0; i < pinfo->dlpi_phnum; i++) {
OpenPOWER on IntegriCloud