From 47a70901841dedf5a3067a6798e29da42fb14fbe Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 19 Dec 2001 23:54:26 +0000 Subject: * elfcode.h (elf_slurp_symbol_table): Test elf_elfsections for NULL, as can happen with a core file, before dereferencing. --- bfd/ChangeLog | 5 +++++ bfd/elfcode.h | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'bfd') diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 619f42c..447be3d 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2001-12-20 Alan Modra + + * 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 * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): If new_size 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); -- cgit v1.1