aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-08-25 01:48:08 +0930
committerAlan Modra <amodra@gmail.com>2021-01-28 11:49:44 +1030
commit9010a66f2dd947815fa1b8ff10054e07ac76cc58 (patch)
tree79fe01b2a64f7fd41027ba6881c9317233815aac
parentSegmentation fault i386-gen (diff)
downloadbinutils-gdb-9010a66f2dd947815fa1b8ff10054e07ac76cc58.tar.gz
binutils-gdb-9010a66f2dd947815fa1b8ff10054e07ac76cc58.tar.bz2
binutils-gdb-9010a66f2dd947815fa1b8ff10054e07ac76cc58.zip
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. (cherry picked from commit a8d549c006a2135b86186d14ab5d0d5fdb702b2f)
-rw-r--r--bfd/ChangeLog8
-rw-r--r--bfd/elf32-ppc.c5
2 files changed, 11 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 6a2e70291d..b7b23513cb 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+2021-01-28 Alan Modra <amodra@gmail.com>
+
+ Apply from master
+ 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.
+
2021-01-24 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/27231
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 24b1485edf..11ae6e82f4 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -2233,8 +2233,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. */