]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR26483, ASAN: ppc_elf_link_params elf32-ppc.c:2314
authorAlan Modra <amodra@gmail.com>
Mon, 24 Aug 2020 16:18:08 +0000 (01:48 +0930)
committerAlan Modra <amodra@gmail.com>
Thu, 28 Jan 2021 01:19:44 +0000 (11:49 +1030)
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)

bfd/ChangeLog
bfd/elf32-ppc.c

index 6a2e70291d4630edb82343f2a8aa4a2fdfeec2ee..b7b23513cb0dcdd75e50a03e559c984e178d8c1c 100644 (file)
@@ -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
index 24b1485edf6ce2164163b999f05d5ceb0f8ea7b0..11ae6e82f4b6b5e5c992a763bedccd3f41676457 100644 (file)
@@ -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.  */