Commit: PR 22509: Check for a NULL symbol pointer when reading COFF relocs

Nick Clifton nickc@redhat.com
Wed Nov 29 17:12:00 GMT 2017


Hi Guys,

  I am applying the patch below as a fix for PR 22509.  This
  triggered a seg-fault in objdump when it was tring to display
  the relocs in a corrupt COFF file.

Cheers
  Nick

bfd/ChangeLog
2017-11-29  Nick Clifton  <nickc@redhat.com>

	PR 22509
	* coffcode.h (coff_slurp_reloc_table): Check for a NULL symbol
	pointer when processing relocs.

diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 604ba6d8d9..d30cd58c4f 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -5335,7 +5335,7 @@ coff_slurp_reloc_table (bfd * abfd, sec_ptr asect, asymbol ** symbols)
 #else
       cache_ptr->address = dst.r_vaddr;
 
-      if (dst.r_symndx != -1)
+      if (dst.r_symndx != -1 && symbols != NULL)
 	{
 	  if (dst.r_symndx < 0 || dst.r_symndx >= obj_conv_table_size (abfd))
 	    {



More information about the Binutils mailing list