aboutsummaryrefslogtreecommitdiff
path: root/ld/pe-dll.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2021-03-15 11:00:44 +0100
committerJan Beulich <jbeulich@suse.com>2021-03-15 11:00:44 +0100
commitc68b1842bdb3cedce0cac7da43045c3788085a91 (patch)
tree9f9e316d7621c53ca03359f1d53baca52f6d634e /ld/pe-dll.c
parentba6a0ef34933712ec65855997e982bead3b314d4 (diff)
downloadgdb-c68b1842bdb3cedce0cac7da43045c3788085a91.zip
gdb-c68b1842bdb3cedce0cac7da43045c3788085a91.tar.gz
gdb-c68b1842bdb3cedce0cac7da43045c3788085a91.tar.bz2
ld: don't chance overrunning PE .reloc section content
The allocation of reloc_d doesn't take reloc_s->size into account. There is already padding being emitted up to the allocated size. While reloc_s->size ought to still be zero at this point anyway (and hence the code being deleted would have been just dead), don't risk writing past the actual allocation.
Diffstat (limited to 'ld/pe-dll.c')
-rw-r--r--ld/pe-dll.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/ld/pe-dll.c b/ld/pe-dll.c
index afcf6fe..eaecb95 100644
--- a/ld/pe-dll.c
+++ b/ld/pe-dll.c
@@ -1752,9 +1752,6 @@ generate_reloc (bfd *abfd, struct bfd_link_info *info)
if (page_ptr != (bfd_vma) -1)
bfd_put_32 (abfd, reloc_sz - page_ptr, reloc_d + page_ptr + 4);
-
- while (reloc_sz < reloc_s->size)
- reloc_d[reloc_sz++] = 0;
}
/* Given the exiting def_file structure, print out a .DEF file that