summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Cheng2012-12-11 12:55:11 -0600
committerAndroid (Google) Code Review2012-12-11 12:55:11 -0600
commitbecea6e04e7f7cca3eaa514d5749d315c6213b25 (patch)
tree2ed1d45f1792d8b5374790200aff622f7765322e
parentfd8e6504e355d2c73a2aaad260475f72af0495bf (diff)
parentc076030eaa9f1c9215bf8bff8524c034b187ed77 (diff)
downloadplatform-system-core-becea6e04e7f7cca3eaa514d5749d315c6213b25.tar.gz
platform-system-core-becea6e04e7f7cca3eaa514d5749d315c6213b25.tar.xz
platform-system-core-becea6e04e7f7cca3eaa514d5749d315c6213b25.zip
Merge "Fix ELF header parser bug." into jb-mr1.1-dev
-rw-r--r--libcorkscrew/arch-arm/ptrace-arm.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libcorkscrew/arch-arm/ptrace-arm.c b/libcorkscrew/arch-arm/ptrace-arm.c
index 868230ceb..78a9ea9a4 100644
--- a/libcorkscrew/arch-arm/ptrace-arm.c
+++ b/libcorkscrew/arch-arm/ptrace-arm.c
@@ -29,12 +29,15 @@
29static void load_exidx_header(pid_t pid, map_info_t* mi, 29static void load_exidx_header(pid_t pid, map_info_t* mi,
30 uintptr_t* out_exidx_start, size_t* out_exidx_size) { 30 uintptr_t* out_exidx_start, size_t* out_exidx_size) {
31 uint32_t elf_phoff; 31 uint32_t elf_phoff;
32 uint32_t elf_phentsize_phnum; 32 uint32_t elf_phentsize_ehsize;
33 uint32_t elf_shentsize_phnum;
33 if (try_get_word_ptrace(pid, mi->start + offsetof(Elf32_Ehdr, e_phoff), &elf_phoff) 34 if (try_get_word_ptrace(pid, mi->start + offsetof(Elf32_Ehdr, e_phoff), &elf_phoff)
35 && try_get_word_ptrace(pid, mi->start + offsetof(Elf32_Ehdr, e_ehsize),
36 &elf_phentsize_ehsize)
34 && try_get_word_ptrace(pid, mi->start + offsetof(Elf32_Ehdr, e_phnum), 37 && try_get_word_ptrace(pid, mi->start + offsetof(Elf32_Ehdr, e_phnum),
35 &elf_phentsize_phnum)) { 38 &elf_shentsize_phnum)) {
36 uint32_t elf_phentsize = elf_phentsize_phnum >> 16; 39 uint32_t elf_phentsize = elf_phentsize_ehsize >> 16;
37 uint32_t elf_phnum = elf_phentsize_phnum & 0xffff; 40 uint32_t elf_phnum = elf_shentsize_phnum & 0xffff;
38 for (uint32_t i = 0; i < elf_phnum; i++) { 41 for (uint32_t i = 0; i < elf_phnum; i++) {
39 uintptr_t elf_phdr = mi->start + elf_phoff + i * elf_phentsize; 42 uintptr_t elf_phdr = mi->start + elf_phoff + i * elf_phentsize;
40 uint32_t elf_phdr_type; 43 uint32_t elf_phdr_type;