binutils Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
ld/pdb

ld/pdb: Avoid double-free on malformed symbol data

Fixes a double-free bug in PDB symbol processing when debug section handling fails.

When the handle_debugs_section function failed during PDB symbol processing, it would free the array of file objects for all modules, including the current one. Subsequently, populate_module_stream would also attempt to free this same array, leading to a double-free error. This commit removes the redundant free call in populate_module_stream to resolve the issue.

In Details

In populate_module_stream, if handle_debugt_section returns false, control flow transfers to a cleanup section that frees mod_source->files. However, if handle_debugs_section fails earlier, it already frees mod_source->files. This commit corrects the logic by removing the duplicate free(mod_source->files) in the error path of populate_module_stream to prevent a double-free.

For Context
double-free
A memory error that occurs when the same memory region is freed more than once. This can corrupt memory management data and lead to crashes or security vulnerabilities.
PDB
Program Database file. Stores debugging and project-specific information for Microsoft Windows applications. The linker generates PDB files for debugging symbols.
handle_debugs_section
A function within ld/pdb.c responsible for processing debug sections, likely related to symbol and type information, within PDB files.
populate_module_stream
A function in ld/pdb.c that populates module information streams within a PDB file, processing symbol and type data.
Filed Under: ldpdbbugfixmemory safety