binutils Newspaper
OCTOBER 6, 2026
binutils — Proposed

PR 29482 buffer overflow

Fix buffer overflow in _bfd_ecoff_set_section_contents by adding sanity checks.

This patch addresses a buffer overflow vulnerability in _bfd_ecoff_set_section_contents by introducing the same safety checks present in coff_set_section_contents. The vulnerability was missed in a previous commit. The fix involves rewriting the sanity check to avoid run-time division.

In Details

The change applies a fix to bfd/ecoff.c and bfd/coffcode.h to prevent a buffer overflow. Specifically, _bfd_ecoff_set_section_contents now includes the same division-avoiding sanity checks as coff_set_section_contents. This addresses a security concern related to how section contents are set, particularly for .lib sections where a physical address field is repurposed.

For Context
buffer overflow
A condition where a program writes data beyond the allocated buffer, potentially corrupting adjacent memory or causing a crash.
.lib section
A section in an object file that, in the context of coff_set_section_contents, stores information about shared libraries.
sanity check
A validation step to ensure that input data or program state is within expected, safe bounds before proceeding with an operation.
Filed Under: securitybfdbuffer overflow