This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] PR ld/20376: Check p_paddr for program header space
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: binutils at sourceware dot org
- Date: Tue, 19 Jul 2016 07:29:31 -0700
- Subject: [PATCH] PR ld/20376: Check p_paddr for program header space
- Authentication-results: sourceware.org; auth=none
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Issue an error if p_paddr becomes invalid when allocating space for
program headers.
OK for master?
H.J.
---
PR ld/20376
* elf.c (assign_file_positions_for_load_sections): Also check
p_paddr for program header space.
---
bfd/elf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/bfd/elf.c b/bfd/elf.c
index ebcf40a..2cc64e8 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -5271,7 +5271,9 @@ assign_file_positions_for_load_sections (bfd *abfd,
p->p_memsz = bed->s->sizeof_ehdr;
if (m->count > 0)
{
- if (p->p_vaddr < (bfd_vma) off)
+ if (p->p_vaddr < (bfd_vma) off
+ || (!m->p_paddr_valid
+ && p->p_paddr < (bfd_vma) off))
{
(*_bfd_error_handler)
(_("%B: Not enough room for program headers, try linking with -N"),
--
2.7.4