binutils Newspaper
OCTOBER 6, 2026
binutils — Proposed

coff-go32-exe segv in _bfd_pe_print_private_bfd_data_common

Fixes a segfault in binutils when handling coff-go32-exe files due to incorrect offset interpretation.

A segfault in binutils’ _bfd_pe_print_private_bfd_data_common function, triggered by oss-fuzz, is addressed by this patch. The issue arises from a recent change that repurposed the bfd.offset field for coff-go32-exe files, causing confusion in format checking. This change introduces bfd_preserve_save and bfd_preserve_restore to correctly handle the origin field, ensuring that files are accurately recognized as coff-go32-exe and not misidentified as other PE variants.

In the Thread 1 participant
  1. Alan Modra <amodra@gmail.com> proposer

    Submits a patch to fix a segfault in binutils related to handling coff-go32-exe files by correctly managing the `bfd.offset` and `origin` fields.

    “Commit 4d095f5b5e57 made use of bfd.offset in coff-go32-exe object files, changing the field's meaning from "offset in an archive". This results in some confusion in bfd_check_format after an object file has been successfully recognised as coff-go32-exe because bfd.offset is then set for any further target matches (which means the match is done against that part of the file after the go32 stub).…”

In Details

This patch addresses a bug in binutils' BFD library concerning the interpretation of file offsets for coff-go32-exe executables. A recent commit changed the meaning of bfd.offset from an archive member offset to an internal file offset, confusing the format detection logic. The fix involves correctly saving and restoring the origin field of struct bfd_preserve to ensure proper file identification, preventing segfaults and incorrect format ambiguities.

For Context
coff-go32-exe
A specific executable file format used for 32-bit DOS extenders, often associated with DJGPP.
BFD
The Binary File Descriptor library, a backend for binutils that provides a common interface for reading and writing various executable file formats.
segv
Segmentation fault, a runtime error that occurs when a program accesses a memory location that it's not allowed to access.
oss-fuzz
An open-source fuzzing service that helps projects find bugs in their code by automatically generating and testing inputs.
PE
Portable Executable, the file format used for executables, object code, and DLLs on 32-bit and 64-bit versions of Windows.
Filed Under: binutilsbugfixcoffPEsegfault