binutils Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
bfd

Binutils BFD declines non-XCOFF output in build_dynamic_sections to prevent crashes.

BFD now correctly rejects non-XCOFF outputs in `build_dynamic_sections` to prevent heap corruption.

A fix has been implemented in BFD’s bfd_xcoff_build_dynamic_sections function to prevent crashes when a linker script selects a non-XCOFF output format. Previously, this scenario led to an out-of-bounds read due to the use of a generic hash table instead of the expected XCOFF-specific one. The function now returns early if the output BFD does not have the XCOFF flavor, aligning with existing checks.

In Details

This commit adds a guard to bfd_xcoff_build_dynamic_sections to immediately return if the output_bfd's flavour is not bfd_target_xcoff_flavour. This addresses a crash scenario where AIX emulations, via a linker script's OUTPUT_FORMAT directive, could select a non-XCOFF output format (e.g., elf32-little). In such cases, bfd_xcoff_build_dynamic_sections would operate on a generic bfd_link_hash_table instead of the expected larger xcoff_link_hash_table. Accessing xcoff_hash_table(info)->ldinfo then caused an out-of-bounds read, reported as a heap-use-after-free by ASan due to m…

For Context
XCOFF
Extended Common Object File Format, a file format for object files and executables used primarily on AIX systems.
build_dynamic_sections
A BFD function responsible for constructing the dynamic linking sections within an output object file.
bfd_link_hash_table
The data structure used by the binutils linker to manage symbols and relocations.
ASan
AddressSanitizer, a memory error detector for C/C++ that finds use-after-free, heap buffer overflows, and use-after-scope.
Filed Under: bfdlinkeraixsecurity