From b66930fa04c82f6f1a507383a5213f022aa007df Mon Sep 17 00:00:00 2001 From: John Reiser Date: Fri, 10 Nov 2000 20:26:57 +0000 Subject: [PATCH] default for AT_PHDR if no PT_PHDR (as in static upx) l_lx_elf.c l_lx_sep.c; not needed in l_lx_sh.c committer: jreiser 973888017 +0000 --- src/stub/l_lx_elf.c | 3 ++- src/stub/l_lx_sep.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/stub/l_lx_elf.c b/src/stub/l_lx_elf.c index 16fdf5b5..b86a95d9 100644 --- a/src/stub/l_lx_elf.c +++ b/src/stub/l_lx_elf.c @@ -344,7 +344,8 @@ void *upx_main( xi.buf -= 2*sizeof(size_t) + sz_pckhdrs; xi.size = ((Elf32_Phdr const *)(1 + my_ehdr))->p_filesz - lsize; - av[0].a_type = AT_PHDR; // av[0].a_un.a_val is set by do_xmap + // av[0].a_un.a_val is set again by do_xmap if PT_PHDR is present + av[0].a_type = AT_PHDR; av[0].a_un.a_ptr = 1+(Elf32_Ehdr *)phdr->p_vaddr; av[1].a_type = AT_PHENT; av[1].a_un.a_val = ehdr->e_phentsize; av[2].a_type = AT_PHNUM; av[2].a_un.a_val = ehdr->e_phnum; av[3].a_type = AT_PAGESZ; av[3].a_un.a_val = PAGE_SIZE; diff --git a/src/stub/l_lx_sep.c b/src/stub/l_lx_sep.c index c2202904..55874332 100644 --- a/src/stub/l_lx_sep.c +++ b/src/stub/l_lx_sep.c @@ -394,7 +394,8 @@ ERR_LAB if (lseek(fdi, -(sizeof(xo) + sz_pckhdrs), SEEK_CUR) < 0) { err_exit(17); } - av[0].a_type = AT_PHDR; av[0].a_un.a_val = 0; // updated by do_xmap + // av[0].a_un.a_val is set again by do_xmap if PT_PHDR is present + av[0].a_type = AT_PHDR; av[0].a_un.a_ptr = 1+(Elf32_Ehdr *)phdr->p_vaddr; av[1].a_type = AT_PHENT; av[1].a_un.a_val = ehdr->e_phentsize; av[2].a_type = AT_PHNUM; av[2].a_un.a_val = ehdr->e_phnum; av[3].a_type = AT_PAGESZ; av[3].a_un.a_val = PAGE_SIZE;