summaryrefslogtreecommitdiffstats
path: root/src/elflint.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2012-05-09 11:27:44 +0200
committerMark Wielaard <[email protected]>2012-05-09 11:28:43 +0200
commit36aa5987df20c340fdfc584e04f4b3931a89abbd (patch)
tree5f9780ff354f5fd172765db8a2a60bef34e78e2c /src/elflint.c
parentd9bc75fc20f0ce5064cac192a518af3c7192e96d (diff)
elflint: Allow zero sized sections at (filesz) end of segment.
Diffstat (limited to 'src/elflint.c')
-rw-r--r--src/elflint.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/elflint.c b/src/elflint.c
index a03caac1..7c560694 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -3716,8 +3716,10 @@ section [%2zu] '%s' is both executable and writable\n"),
|| (phdr->p_type == PT_TLS
&& (shdr->sh_flags & SHF_TLS) != 0))
&& phdr->p_offset <= shdr->sh_offset
- && (phdr->p_offset + phdr->p_filesz > shdr->sh_offset
- || (phdr->p_offset + phdr->p_memsz > shdr->sh_offset
+ && ((shdr->sh_offset - phdr->p_offset <= phdr->p_filesz
+ && (shdr->sh_offset - phdr->p_offset < phdr->p_filesz
+ || shdr->sh_size == 0))
+ || (shdr->sh_offset - phdr->p_offset < phdr->p_memsz
&& shdr->sh_type == SHT_NOBITS)))
{
/* Found the segment. */