buffer overflow in nds32_elf_lo12_reloc
Project / Subsystem
binutils / binutils
Date
2026-05-26
Proposer
Alan Modra <amodra@gmail.com>
Source type
public_inbox
Consensus
Proposed
Sentiment
—/10
Technical tradeoffs
- • Adds a runtime check, which may introduce a small performance overhead.
- • Replaces a function call with a macro, which may improve performance slightly.
All attributes
- project
- binutils
- subsystem
- binutils
- patch_id
- —
- discussion_id
- ahVrCSmtOp-QIIkU@squeak.grove.modra.org
- source_type
- public_inbox
- title
- buffer overflow in nds32_elf_lo12_reloc
- headline
- Fixes buffer overflow in nds32_elf_lo12_reloc
- tldr
- Adds a sanity check to nds32_elf_lo12_reloc to prevent reading beyond the allocated buffer, and replaces a function call with a constant.
- proposer
- Alan Modra <amodra@gmail.com>
- consensus
- Proposed
- outcome
- proposed
- sentiment_score
- —
- technical_tradeoffs
-
- • Adds a runtime check, which may introduce a small performance overhead.
- • Replaces a function call with a macro, which may improve performance slightly.
- series_id
- —
- series_role
- standalone
- series_parts
- []
- tags
-
- • security
- • bugfix
- • bfd
- • relocation
- • nds32
- bugzilla_url
- —
- date
- 2026-05-26T00:00:00.000Z
buffer overflow in nds32_elf_lo12_reloc
This patch adds a sanity check to the nds32_elf_lo12_reloc function to ensure that the relocation offset is within the valid range, preventing potential buffer overflows when processing stashed hi relocs. It also replaces bfd_octets_per_byte calls with the OCTETS_PER_BYTE macro throughout the elf32-nds32.c file for consistency and potential performance gains. This prevents out-of-bounds reads and possible crashes when processing crafted or malformed binaries.