PR 34327 More out of bounds accesses in reloc special functions
Addresses more instances of out-of-bounds reads in relocation functions across various targets.
This patch series extends the bug fixes from a previous submission, addressing additional locations within relocation special functions that were susceptible to out-of-bounds reads. It applies sanity checks for relocation offsets and performs cleanup, such as removing unnecessary casts, across a range of architectures including ARM, MIPS, SPARC, and others.
- proposer
Submits a follow-up patch to fix more instances of out-of-bounds reads in relocation special functions, expressing hope that no new issues are introduced.
“I don't claim to have caught all places where reloc special functions don't sanity check input, but this should be most of them. Hopefully this does not expose odd reloc howto entries like the mmix one in the previous patch.”
In Details
Following up on a prior fix, this patch series continues to identify and rectify instances of out-of-bounds reads within binutils' BFD library, specifically in relocation handling code. The fixes involve adding robust sanity checks for relocation offsets across multiple ELF and COFF targets, aiming to prevent memory corruption and crashes originating from malformed input object files.
- relocation
- A directive that describes how to modify code or data when an object file is linked. Relocations typically specify an address and the type of modification needed, such as patching in an offset or a symbol address.
- out-of-bounds access
- An error where a program attempts to read from or write to a memory location that is outside the allocated bounds of an array or buffer, potentially leading to data corruption or crashes.
- ELF
- Executable and Linkable Format, a standard file format for executables, object code, shared libraries, and core dumps on many Unix-like systems.
- COFF
- Common Object File Format, an older object file format used on some Unix systems, and also the basis for the PE format used on Windows.