Landing: e0fe0e3abde3

Project / Subsystem

binutils / bfd

Date

2026-06-13

Author

Alan Modra <amodra@sourceware.org>

Commit

e0fe0e3abde305a34de82134b7d8a7fa153d1897

Source

public_inbox

Perf win

No

Breaking

No

All attributes

project
binutils
subsystem
bfd
patch_id
commit_hash
e0fe0e3abde305a34de82134b7d8a7fa153d1897
source_type
public_inbox
headline
Check allocation returns in elflink.c and optimize string concatenation
tldr
This commit adds null checks for `bfd_alloc` and `bfd_malloc` in `elflink.c` and replaces `sprintf` with `memcpy` for string concatenation, enhancing robustnes…
author
Alan Modra <amodra@sourceware.org>
outcome
committed
performance_win
false
breaking_change
false
series_id
series_parts
[]
tags
  • bugfix
  • elf
  • performance
  • robustness
discussion_id_link
bugzilla_pr
date
2026-06-13T00:00:00.000Z

The Binutils BFD library’s elflink.c file, responsible for ELF linking, has been made more robust by adding checks for non-null returns from memory allocation functions (bfd_alloc and bfd_malloc). Previously, a failed allocation could lead to undefined behavior or crashes. Additionally, a less efficient sprintf call for concatenating strings in get_dynamic_reloc_section_name has been replaced with faster memcpy operations, improving performance and reliability.