bfd: validate COFF and XCOFF symbol tables before the linker walks them
Harshit Kumar submits a patch to validate COFF and XCOFF symbol tables in bfd to prevent buffer overflows when the linker processes them.
Harshit Kumar proposes a patch to enhance the robustness of the binutils linker by validating COFF and XCOFF symbol tables. The current implementation can lead to buffer overflows if a symbol claims more auxiliary entries than available, potentially causing heap writes. This patch addresses unvalidated paths in both COFF and XCOFF processing, building upon previous hardening efforts.
- proposer
Submits a patch to validate COFF and XCOFF symbol tables in binutils' bfd library to prevent buffer overflows during linker processing.
In Details
This patch addresses a security vulnerability in the binutils BFD library concerning the parsing of COFF and XCOFF symbol tables. Specifically, it fixes potential buffer overflows in cofflink.c and xcofflink.c that occur when a symbol's auxiliary entry count exceeds the available data, leading to out-of-bounds writes.
- COFF
- Common Object File Format, a standard file format for object files, executable files, and dynamic libraries.
- XCOFF
- Extended Common Object File Format, an extension of COFF used on some Unix systems, notably AIX.
- BFD
- Binary File Descriptor library, a low-level interface within binutils for handling various object file formats.
- symbol table
- A data structure within an object file that lists the symbols (e.g., function names, variable names) defined or referenced by the file.
- auxiliary entries
- Additional information associated with a symbol in some object file formats (like COFF) that provides further details, such as the number of external references.
- buffer overflow
- A condition where a program attempts to write data beyond the allocated buffer's boundary, potentially corrupting adjacent memory or causing a crash.