[PATCH][binutils][2_40 4/4] Backport fix for PR 32644(CVE-2025-1182)

Harish.Sadineni@windriver.com Harish.Sadineni@windriver.com
Thu May 29 08:29:26 GMT 2025
From: Nick Clifton <nickc@redhat.com>

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

PR 32644

Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
 bfd/elflink.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/bfd/elflink.c b/bfd/elflink.c
index 973b53f27cb..3534efb73f5 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -14812,6 +14812,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.  */
-- 
2.49.0



More information about the Binutils mailing list