[binutils-gdb] asan: unknown write in z80_elf_16_be_reloc
Alan Modra via Binutils-cvs <[email protected]>
| Newsgroups | gmane.comp.gnu.binutils.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8dc535c59fdbcf99e28703425e5c1c711e63a1f1 commit 8dc535c59fdbcf99e28703425e5c1c711e63a1f1 Author: Alan Modra <[email protected]> Date: Thu Apr 23 15:08:37 2026 +0930 asan: unknown write in z80_elf_16_be_reloc * elf32-z80.c (z80_elf_16_be_reloc): Sanity check reloc offset. Diff: --- bfd/elf32-z80.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bfd/elf32-z80.c b/bfd/elf32-z80.c index 8eacfd7e464..1dc2e192adc 100644 --- a/bfd/elf32-z80.c +++ b/bfd/elf32-z80.c @@ -580,6 +580,10 @@ z80_elf_16_be_reloc (bfd *abfd, return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message); + if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd, + input_section, octets)) + return bfd_reloc_outofrange; + /* Get symbol value. */ val = 0; if (!bfd_is_com_section (symbol->section))