[binutils-gdb] PR26483, ASAN: ppc_elf_link_params elf32-ppc.c:2314

Alan Modra amodra@sourceware.org
Mon Aug 24 16:43:22 GMT 2020


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a8d549c006a2135b86186d14ab5d0d5fdb702b2f

commit a8d549c006a2135b86186d14ab5d0d5fdb702b2f
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Aug 25 01:48:08 2020 +0930

    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.

Diff:
---
 bfd/ChangeLog   | 6 ++++++
 bfd/elf32-ppc.c | 5 +++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b068c3891ab..aae0c4d02a5 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2020-08-25  Alan Modra  <amodra@gmail.com>
+
+	PR 26483
+	* elf32-ppc.c (ppc_elf_hash_table): Test is_elf_hash_table before
+	accessing elf_hash_table_id.
+
 2020-08-24  Mark Wielaard  <mark@klomp.org>
 
 	* dwarf2.c (read_attribute_value): Handle DW_FORM_data16.
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 43c0e188967..66265ef6009 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.  */


More information about the Binutils-cvs mailing list