This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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))
 	    {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]