diff options
author | Alan Modra <amodra@gmail.com> | 2025-04-10 19:41:49 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2025-04-10 19:45:59 +0930 |
commit | d1458933830456e54223d9fc61f0d9b3a19256f5 (patch) | |
tree | 98864afbaa67a592824cc9f0c846bce8efde33c9 | |
parent | 6fe4e5bd10b996428a557e036c07c5839a8e0a49 (diff) | |
download | binutils-d1458933830456e54223d9fc61f0d9b3a19256f5.zip binutils-d1458933830456e54223d9fc61f0d9b3a19256f5.tar.gz binutils-d1458933830456e54223d9fc61f0d9b3a19256f5.tar.bz2 |
PR32858 ld segfault on fuzzed object
We missed one place where it is necessary to check for empty groups.
PR 32858
* elflink.c (elf_gc_sweep): Protect against empty group.
-rw-r--r-- | bfd/elflink.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c index a76e8e3..549b7b7 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -14408,7 +14408,8 @@ elf_gc_sweep (bfd *abfd, struct bfd_link_info *info) if (o->flags & SEC_GROUP) { asection *first = elf_next_in_group (o); - o->gc_mark = first->gc_mark; + if (first != NULL) + o->gc_mark = first->gc_mark; } if (o->gc_mark) |