PR26492, ASAN: ppc64_elf_before_check_relocs elf64-ppc.c:4337

Alan Modra amodra@gmail.com
Mon Aug 24 16:38:48 GMT 2020


	PR 26492
	* elf64-ppc.c (ppc_hash_table): Test is_elf_hash_table before
	accessing elf_hash_table_id.

diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 02f0f18fc7..5a21bfafbc 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -3276,8 +3276,9 @@ struct ppc_link_hash_table
 /* Get the ppc64 ELF linker hash table from a link_info structure.  */
 
 #define ppc_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == PPC64_ELF_DATA ? ((struct ppc_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)					\
+    && elf_hash_table_id (elf_hash_table (p)) == PPC64_ELF_DATA)	\
+   ? (struct ppc_link_hash_table *) (p)->hash : NULL)
 
 #define ppc_stub_hash_lookup(table, string, create, copy) \
   ((struct ppc_stub_hash_entry *) \

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list