From: Alan Modra Date: Sun, 3 Sep 2017 23:05:21 +0000 (+0930) Subject: PR22067, x86 check_relocs invalid read X-Git-Tag: binutils-2_29_1~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4b2b2eec571dd6b78368661c3084df0ce6d9fff2;p=thirdparty%2Fbinutils-gdb.git PR22067, x86 check_relocs invalid read 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. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b5f1204e640..9df9bc6646b 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2017-09-04 Alan Modra + + 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 PR ld/22064 diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index a2866c5d7fd..c123f122c30 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -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) \ diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 59926b6092f..c59b8c015bd 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -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) \