From: Alan Modra Date: Thu, 10 Apr 2025 10:11:49 +0000 (+0930) Subject: PR32858 ld segfault on fuzzed object X-Git-Tag: binutils-2_45~923 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d1458933830456e54223d9fc61f0d9b3a19256f5;p=thirdparty%2Fbinutils-gdb.git 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. --- diff --git a/bfd/elflink.c b/bfd/elflink.c index a76e8e38da7..549b7b7dd92 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)