diff options
author | norly <ny-git@enpas.org> | 2013-06-26 18:44:42 +0100 |
---|---|---|
committer | norly <ny-git@enpas.org> | 2013-06-26 18:44:42 +0100 |
commit | ba9a2612324c2cfaf63d64a722a1a0ecc5793de7 (patch) | |
tree | 57292a1375d84bd5e386fe762f5721bf4167496b | |
parent | a417ad3293da4293cfcc4b43ea146a272247d9ea (diff) |
Expand downwards only if there is enough space
-rw-r--r-- | src/libelfu/modelops/layout.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libelfu/modelops/layout.c b/src/libelfu/modelops/layout.c index 4026e58..f8a30ed 100644 --- a/src/libelfu/modelops/layout.c +++ b/src/libelfu/modelops/layout.c @@ -240,7 +240,8 @@ GElf_Addr elfu_mLayoutGetSpaceInPhdr(ElfuElf *me, GElf_Word size, } else if (((w && (lowestAddr->phdr.p_flags & PF_W)) || (x && (lowestAddr->phdr.p_flags & PF_X))) && /* Enough space to expand downwards? */ - (lowestAddr->phdr.p_vaddr > 3 * lowestAddr->phdr.p_align) + (lowestAddr->phdr.p_vaddr >= ((2 * lowestAddr->phdr.p_align) + + ROUNDUP(size, lowestAddr->phdr.p_align))) /* Merging only works if the LOAD is the first both in file and mem */ && lowestAddr == lowestOffs) { /* Need to prepend or split up the PHDR. */ |