aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfcode.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2001-12-19 23:54:26 +0000
committerAlan Modra <amodra@gmail.com>2001-12-19 23:54:26 +0000
commit47a70901841dedf5a3067a6798e29da42fb14fbe (patch)
treeee1d970bb96e4d96d0479134d85fa065decbc920 /bfd/elfcode.h
parentb09677dcf8a9bdd68e824964d379eabeda1e39df (diff)
downloadgdb-47a70901841dedf5a3067a6798e29da42fb14fbe.zip
gdb-47a70901841dedf5a3067a6798e29da42fb14fbe.tar.gz
gdb-47a70901841dedf5a3067a6798e29da42fb14fbe.tar.bz2
* elfcode.h (elf_slurp_symbol_table): Test elf_elfsections for NULL,
as can happen with a core file, before dereferencing.
Diffstat (limited to 'bfd/elfcode.h')
-rw-r--r--bfd/elfcode.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index 204756c..203323c 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -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);