aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-ppc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-08-25 01:48:08 +0930
committerAlan Modra <amodra@gmail.com>2020-08-25 02:11:13 +0930
commita8d549c006a2135b86186d14ab5d0d5fdb702b2f (patch)
tree10e07e12fc3ff75ab0370c55f4c15a7cd200aa16 /bfd/elf32-ppc.c
parent19d80e5fec548e681c453d15b4ae5b49bc080acc (diff)
downloadgdb-a8d549c006a2135b86186d14ab5d0d5fdb702b2f.zip
gdb-a8d549c006a2135b86186d14ab5d0d5fdb702b2f.tar.gz
gdb-a8d549c006a2135b86186d14ab5d0d5fdb702b2f.tar.bz2
PR26483, ASAN: ppc_elf_link_params elf32-ppc.c:2314
PR 26483 * elf32-ppc.c (ppc_elf_hash_table): Test is_elf_hash_table before accessing elf_hash_table_id.
Diffstat (limited to 'bfd/elf32-ppc.c')
-rw-r--r--bfd/elf32-ppc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 43c0e18..66265ef 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -2230,8 +2230,9 @@ struct ppc_elf_link_hash_table
/* Get the PPC ELF linker hash table from a link_info structure. */
#define ppc_elf_hash_table(p) \
- (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
- == PPC32_ELF_DATA ? ((struct ppc_elf_link_hash_table *) ((p)->hash)) : NULL)
+ ((is_elf_hash_table ((p)->hash) \
+ && elf_hash_table_id (elf_hash_table (p)) == PPC32_ELF_DATA) \
+ ? (struct ppc_elf_link_hash_table *) (p)->hash : NULL)
/* Create an entry in a PPC ELF linker hash table. */