* elfcode.h (elf_slurp_symbol_table): Test elf_elfsections for NULL,
authorAlan Modra <amodra@gmail.com>
Wed, 19 Dec 2001 23:54:26 +0000 (23:54 +0000)
committerAlan Modra <amodra@gmail.com>
Wed, 19 Dec 2001 23:54:26 +0000 (23:54 +0000)
as can happen with a core file, before dereferencing.

bfd/ChangeLog
bfd/elfcode.h

index 619f42c52ccb77db152730c951f4df9f3e6cd330..447be3dbd455c9bfa3aa1eba21a380a697182d06 100644 (file)
@@ -1,3 +1,8 @@
+2001-12-20  Alan Modra  <amodra@bigpond.net.au>
+
+       * elfcode.h (elf_slurp_symbol_table): Test elf_elfsections for NULL,
+       as can happen with a core file, before dereferencing.
+
 2001-12-19  Jakub Jelinek  <jakub@redhat.com>
 
        * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): If new_size
index 204756c745db2f31cc569ad1aa2cd19dffc8f570..203323cdb5e66d36ed774b136798a62bfedb0b2a 100644 (file)
@@ -1150,7 +1150,8 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
 
       /* 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);