binutils Newspaper
OCTOBER 6, 2026
ld/pdb — Proposed

ld/pdb: Terminate string list in S_ENVBLOCK

Adds a null terminator to the string list in S_ENVBLOCK symbols to fix parsing errors.

This patch addresses an issue where the list of strings in an S_ENVBLOCK symbol was not properly terminated, leading to parsing errors when the strings ended on a four-byte boundary. Specifically, it adds a null terminator to the string list, preventing readers like llvm-pdbutil from running off the end of the record and reporting “Stream Error”.

In Details

This patch corrects an error in the PDB writer within binutils' linker (ld). The S_ENVBLOCK symbol type, used for environment variables, stores strings in a list. The previous implementation failed to append a null terminator to this list, which, combined with specific alignment conditions, could cause buffer overflows and parsing failures in tools like llvm-pdbutil. The fix ensures the list is properly terminated.

For Context
PDB
Program Database. A file format used by Microsoft for storing debugging and project-related information for Microsoft Windows applications.
S_ENVBLOCK
A specific symbol type within the PDB format that encapsulates environment variable information.
ld
The GNU linker, responsible for combining object files into an executable or shared library.
llvm-pdbutil
A utility from the LLVM project used for inspecting and manipulating PDB files.
Filed Under: pdblinkerdebuggingbugfix