[binutils-gdb] Fix another illegal memory access triggered by corrupt ELF input files.

Nick Clifton nickc@sourceware.org
Wed Feb 5 16:28:09 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b425859021d17adf62f06fb904797cf8642986ad

commit b425859021d17adf62f06fb904797cf8642986ad
Author: Nick Clifton <nickc@redhat.com>
Date:   Wed Feb 5 16:27:38 2025 +0000

    Fix another illegal memory access triggered by corrupt ELF input files.
    
    PR 32644

Diff:
---
 bfd/elflink.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/bfd/elflink.c b/bfd/elflink.c
index bf940942ec3..df6eb250961 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -15116,6 +15116,10 @@ bfd_elf_reloc_symbol_deleted_p (bfd_vma offset, void *cookie)
 	}
       else
 	{
+	  if (r_symndx >= rcookie->locsymcount)
+	    /* This can happen with corrupt input.  */
+	    return false;
+
 	  /* It's not a relocation against a global symbol,
 	     but it could be a relocation against a local
 	     symbol for a discarded section.  */


More information about the Binutils-cvs mailing list