Linker fixes integer overflow issues in PDB debug info handling
Potential integer overflows in ld/pdb.c related to debug information parsing have been fixed.
This commit addresses potential integer overflows within the ld/pdb.c file, which handles PDB (Program Database) debug information. The changes involve updating data type sizes and validation logic to prevent overflows when processing module source file counts and string table indices. These fixes enhance the robustness of the linker when dealing with debug information, particularly for larger or more complex projects.
In Details
The changes in ld/pdb.c primarily concern the handling of debug information, specifically within the struct mod_source_files and copy_filechksms function. The files_count member of struct mod_source_files was changed from uint16_t to unsigned int to accommodate a larger number of source files. Additionally, the copy_filechksms function's parameters were expanded to include string_table_len and out_len, allowing for more robust validation of input buffer sizes. This prevents potential integer overflows when calculating offsets or accessing arrays, especially when processing…
- PDB
- Program Database. A file format used by Microsoft development tools to store information about a program, including debugging symbols. The GNU linker may process PDB information for compatibility or specific build environments.
- linker
- A program that combines various pieces of code and data (from object files and libraries) into a single executable program or library. It resolves external references and assigns final addresses to code and data.
- debug information
- Metadata embedded in an executable or object file that allows a debugger to understand the program's structure, variable names, source code line numbers, etc. This information is crucial for effective debugging.
- integer overflow
- A condition that occurs when an arithmetic operation produces a result that exceeds the maximum value that can be represented by the data type being used. This can lead to incorrect program behavior or security vulnerabilities.