diff options
author | Alan Modra <amodra@gmail.com> | 2022-08-17 17:14:16 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2022-08-17 17:29:42 +0930 |
commit | 7744e3278b9f24d8a1a2dd74f75986bd9060724c (patch) | |
tree | 1a34f2b9c608340886093320b3cc5bfe9651667a /bfd/elf.c | |
parent | 31e43bfffbc585a59d07f21f191317a714476e38 (diff) | |
download | gdb-7744e3278b9f24d8a1a2dd74f75986bd9060724c.zip gdb-7744e3278b9f24d8a1a2dd74f75986bd9060724c.tar.gz gdb-7744e3278b9f24d8a1a2dd74f75986bd9060724c.tar.bz2 |
bfd_elf_set_group_contents assertion
objcopy of broken SHT_GROUP sections shouldn't write garbage.
* elf.c (bfd_elf_set_group_contents): If number of entries is
unexpected, fill out section with zeros.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r-- | bfd/elf.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -3614,7 +3614,12 @@ bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg) } loc -= 4; - BFD_ASSERT (loc == sec->contents); + if (loc != sec->contents) + { + BFD_ASSERT (0); + memset (sec->contents + 4, 0, loc - sec->contents); + loc = sec->contents; + } H_PUT_32 (abfd, sec->flags & SEC_LINK_ONCE ? GRP_COMDAT : 0, loc); } |