binutils Newspaper
OCTOBER 6, 2026
bfd — Proposed

bfd: pe: Clarify pe_print_pdata() conditional

Clarify and correct the conditional logic in PE .pdata printing.

This patch clarifies the conditional logic within the pe_print_pdata function in bfd/peXXigen.c. It updates comments to reflect the function’s intended behavior and identifies that the existing conditional is pointless, as PE MIPS support was removed. The change also highlights potential issues with the pdata entry size for ia64 and unconstrained reads, suggesting that the current implementation may be incorrect or unsafe for certain architectures.

In Details

This patch addresses confusing and potentially incorrect conditional logic in bfd/peXXigen.c's pe_print_pdata function. The original condition was intended to differentiate between PE MIPS and other architectures but is now obsolete. The author clarifies comments and points out that the logic for ia64's .pdata entry size (3*8 bytes) might be incorrect compared to x86_64's (3*4 bytes), and that unconstrained reads could occur. This sets the stage for further corrections in subsequent patches.

For Context
pe_print_pdata
A function within binutils' BFD library responsible for printing the contents of the .pdata section in PE (Portable Executable) files.
conditional logic
Code that executes different paths based on whether certain conditions are true or false, often implemented using #if, #ifdef, etc.
unconstrained read
Reading data from memory without proper bounds checking, which can lead to accessing invalid memory or security vulnerabilities.
Filed Under: bfdpepdataclarificationcode quality