This is the mail archive of the binutils@sources.redhat.com 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]

Re: [RFA] Make objcopy handle core files.


On Wed, Dec 19, 2001 at 09:54:44AM -0800, Michael Snyder wrote:
> 
> I'll make some effort to track it down, but maybe you
> could look at it too?  The segfault happens far away from
> any of my changes, so it's probably due to something random
> that occurred a long time before the crash itself.

In this case the obvious fix is the correct one.

	* elfcode.h (elf_slurp_symbol_table): Test elf_elfsections for NULL,
	as can happen with a core file, before dereferencing.

-- 
Alan Modra

Index: bfd/elfcode.h
===================================================================
RCS file: /cvs/src/src/bfd/elfcode.h,v
retrieving revision 1.27
diff -u -p -r1.27 elfcode.h
--- elfcode.h	2001/12/18 07:12:19	1.27
+++ elfcode.h	2001/12/19 23:48:35
@@ -1150,7 +1150,8 @@ elf_slurp_symbol_table (abfd, symptrs, d
 
       /* If we have a SHT_SYMTAB_SHNDX section for the symbol table,
 	 read the raw contents.  */
-      if (elf_elfsections (abfd)[shndx_hdr->sh_link] == hdr)
+      if (elf_elfsections (abfd) != NULL
+	  && elf_elfsections (abfd)[shndx_hdr->sh_link] == hdr)
 	{
 	  amt = shndx_hdr->sh_size;
 	  x_shndx = (Elf_External_Sym_Shndx *) bfd_malloc (amt);


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