binutils Newspaper
NOVEMBER 30, 2026
binutils — Proposed

binutils: od-xcoff: check section and aux header reads

Hardens XCOFF parsing by adding checks for section and auxiliary header reads, preventing uninitialized memory exposure and partial entry reads.

This patch improves the robustness of the XCOFF dumper by adding checks for section content reads and auxiliary header parsing. It ensures that .debug, .typchk, and .except sections are read safely, preventing the exposure of uninitialized memory. The patch also fixes issues with parsing partial entries in .typchk and .except sections and ensures auxiliary headers are properly initialized, including new tests for these scenarios.

In the Thread 1 participant
  1. Harshit Kumar <harshit7kr@gmail.com> proposer

    Adds checks for section and auxiliary header reads in XCOFF parsing to prevent memory corruption and incomplete data processing.

    “dump_xcoff32_symbols read the .debug section with bfd_get_section_contents and ignored the result; dump_xcoff32_except did the same, and dump_xcoff32_typchk trusted the section data pointer. A truncated or malformed section could therefore dump uninitialized heap memory. Use bfd_malloc_and_get_section, report failures with non_fatal, and require a DBX name offset to fall inside .debug before pr…”

In Details

This patch enhances the od-xcoff dumper's safety by validating reads from various sections, including .debug, .typchk, and .except. It ensures that section data is read robustly using bfd_malloc_and_get_section, preventing uninitialized memory exposure. Additionally, it corrects parsing logic for .typchk and .except entries to handle only complete records and addresses potential issues with auxiliary header padding, complemented by new test cases.

For Context
XCOFF
A file format used on IBM AIX systems, similar to COFF and ELF.
.debug section
A section in an object file that contains debugging information.
auxiliary header
Additional header information in some object file formats, providing more details about the file structure.
uninitialized memory
Memory that has not been assigned a defined value, potentially containing garbage data.
MemorySanitizer
A tool that detects uses of uninitialized memory during program execution.
Valgrind
A suite of debugging and profiling tools for Linux and macOS, including a memory error detector.
Filed Under: XCOFFhardeningobjdumpdebuggingparsing