]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR22067, x86 check_relocs invalid read
authorAlan Modra <amodra@gmail.com>
Sun, 3 Sep 2017 23:05:21 +0000 (08:35 +0930)
committerAlan Modra <amodra@gmail.com>
Sun, 3 Sep 2017 23:07:57 +0000 (08:37 +0930)
PR 22067
* elf32-i386.c (elf_i386_hash_table): Check is_elf_hash_table first.
* elf64-x86-64.c (elf_x86_64_hash_table): Likewise.

bfd/ChangeLog
bfd/elf32-i386.c
bfd/elf64-x86-64.c

index b5f1204e6405f588faa35f261bc747008ea7159b..9df9bc6646bc3d398a22d7e6366790a2b0c5d47d 100644 (file)
@@ -1,3 +1,9 @@
+2017-09-04  Alan Modra  <amodra@gmail.com>
+
+       PR 22067
+       * elf32-i386.c (elf_i386_hash_table): Check is_elf_hash_table first.
+       * elf64-x86-64.c (elf_x86_64_hash_table): Likewise.
+
 2017-09-01  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/22064
index a2866c5d7fddc475fdd5ea03b80518427cc429a2..c123f122c30305f8b0ffbee1fac8b5eb565f2dc4 100644 (file)
@@ -1113,7 +1113,8 @@ struct elf_i386_link_hash_table
 /* Get the i386 ELF linker hash table from a link_info structure.  */
 
 #define elf_i386_hash_table(p) \
-  (elf_hash_table_id  ((struct elf_link_hash_table *) ((p)->hash)) \
+  (is_elf_hash_table ((p)->hash) \
+   && elf_hash_table_id  ((struct elf_link_hash_table *) ((p)->hash))  \
   == I386_ELF_DATA ? ((struct elf_i386_link_hash_table *) ((p)->hash)) : NULL)
 
 #define elf_i386_compute_jump_table_size(htab) \
index 59926b6092fce8f683e4ea43cb4110599cec07bd..c59b8c015bdf0261f68fcd37b7b3baebe3210246 100644 (file)
@@ -1227,7 +1227,8 @@ struct elf_x86_64_link_hash_table
 /* Get the x86-64 ELF linker hash table from a link_info structure.  */
 
 #define elf_x86_64_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
+  (is_elf_hash_table ((p)->hash) \
+   && elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash))   \
   == X86_64_ELF_DATA ? ((struct elf_x86_64_link_hash_table *) ((p)->hash)) : NULL)
 
 #define elf_x86_64_compute_jump_table_size(htab) \