From 9ebc757b5592844e47bcddfba7335d2e7c590a8b Mon Sep 17 00:00:00 2001 From: norly Date: Wed, 26 Jun 2013 19:49:58 +0100 Subject: [PATCH] Expand PHDR space only if there are pages available --- src/libelfu/modelops/layout.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libelfu/modelops/layout.c b/src/libelfu/modelops/layout.c index f8a30ed..2fd610c 100644 --- a/src/libelfu/modelops/layout.c +++ b/src/libelfu/modelops/layout.c @@ -101,7 +101,8 @@ static ElfuPhdr* appendPhdr(ElfuElf *me) &lowestOffs, &highestOffsEnd); if (phdr_maxsz < (me->ehdr.e_phnum + 1) * me->ehdr.e_phentsize && phdrmp == lowestAddr - && phdrmp == lowestOffs) { + && phdrmp == lowestOffs + && (lowestAddr->phdr.p_vaddr >= 2 * lowestAddr->phdr.p_align)) { ElfuPhdr *mp; ElfuScn *ms; GElf_Word size = ROUNDUP(me->ehdr.e_phentsize, phdrmp->phdr.p_align); -- 2.30.2