]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
PR32662, segv in _bfd_generic_link_output_symbols
authorAlan Modra <amodra@gmail.com>
Sun, 9 Feb 2025 02:22:23 +0000 (12:52 +1030)
committerAlan Modra <amodra@gmail.com>
Sun, 9 Feb 2025 10:12:00 +0000 (20:42 +1030)
commit38ee3a7664f00778fcc895a7f279c289a12cdbfd
tree8d8e41a4749392a0f68c58f7e9ae46bb07445055
parent0dace0da06df5008813997f32fdc1ac64490d61b
PR32662, segv in _bfd_generic_link_output_symbols

asymbol flags zero can result from certain combinations of ELF st_info
binding and type.  asymbol section is set to bfd_abs_section for
genuine absolute symbols and also ones with a bogus st_shndx.  A
fuzzed ELF object with such a symbol can tickle a bug in generic
linker code added by commit d3a65d4dea to avoid an abort, resulting
in a segfault.  This patch fixes the segfault by removing the
sym->section->owner->flags test.  I think it should be OK to exclude
all symbols without any BSF flags set, not just IR symbols.

PR 32662
* linker.c (_bfd_generic_link_output_symbols): Exclude all
symbols with zero flags.  Replace abort with assertion.
Tidy logic.
bfd/linker.c