diff options
author | Ben Cheng <bccheng@google.com> | 2012-12-10 14:51:32 -0800 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2012-12-10 20:49:43 -0800 |
commit | c076030eaa9f1c9215bf8bff8524c034b187ed77 (patch) | |
tree | 487fb16b76270a513ea17d7ea73b0c3d2240502e /libcorkscrew | |
parent | b20fa762b515b5e96c158959d8c8d0c2ff1bf46b (diff) | |
download | system_core-c076030eaa9f1c9215bf8bff8524c034b187ed77.zip system_core-c076030eaa9f1c9215bf8bff8524c034b187ed77.tar.gz system_core-c076030eaa9f1c9215bf8bff8524c034b187ed77.tar.bz2 |
Fix ELF header parser bug.
[cherry-picked from AOSP]
Program header size should be 32 instead of 40.
Bug: 7696928
Change-Id: I48e411837ff8a571544b55ccc37e20202dca424c
Diffstat (limited to 'libcorkscrew')
-rw-r--r-- | libcorkscrew/arch-arm/ptrace-arm.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libcorkscrew/arch-arm/ptrace-arm.c b/libcorkscrew/arch-arm/ptrace-arm.c index 868230c..78a9ea9 100644 --- a/libcorkscrew/arch-arm/ptrace-arm.c +++ b/libcorkscrew/arch-arm/ptrace-arm.c @@ -29,12 +29,15 @@ static void load_exidx_header(pid_t pid, map_info_t* mi, uintptr_t* out_exidx_start, size_t* out_exidx_size) { uint32_t elf_phoff; - uint32_t elf_phentsize_phnum; + uint32_t elf_phentsize_ehsize; + uint32_t elf_shentsize_phnum; if (try_get_word_ptrace(pid, mi->start + offsetof(Elf32_Ehdr, e_phoff), &elf_phoff) + && try_get_word_ptrace(pid, mi->start + offsetof(Elf32_Ehdr, e_ehsize), + &elf_phentsize_ehsize) && try_get_word_ptrace(pid, mi->start + offsetof(Elf32_Ehdr, e_phnum), - &elf_phentsize_phnum)) { - uint32_t elf_phentsize = elf_phentsize_phnum >> 16; - uint32_t elf_phnum = elf_phentsize_phnum & 0xffff; + &elf_shentsize_phnum)) { + uint32_t elf_phentsize = elf_phentsize_ehsize >> 16; + uint32_t elf_phnum = elf_shentsize_phnum & 0xffff; for (uint32_t i = 0; i < elf_phnum; i++) { uintptr_t elf_phdr = mi->start + elf_phoff + i * elf_phentsize; uint32_t elf_phdr_type; |