This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[committed] MIPS/BFD: Fix assertion in `mips_elf_sort_hash_table'
- From: "Maciej W. Rozycki" <macro at imgtec dot com>
- To: <binutils at sourceware dot org>
- Date: Thu, 2 Feb 2017 22:51:36 +0000
- Subject: [committed] MIPS/BFD: Fix assertion in `mips_elf_sort_hash_table'
- Authentication-results: sourceware.org; auth=none
Move the assertion on non-NULL `htab' in `mips_elf_sort_hash_table' to
the beginning, before the pointer is dereferenced (`mips_elf_hash_table
(info)' and `elf_hash_table (info)' both point to the same memory
location, differently typed).
bfd/
* elfxx-mips.c (mips_elf_sort_hash_table): Move assertion on
non-NULL `htab' to the beginning.
---
binutils-mips-bfd-elf-sort-hash-table-assert.diff
Index: binutils/bfd/elfxx-mips.c
===================================================================
--- binutils.orig/bfd/elfxx-mips.c 2017-02-01 14:50:03.082396853 +0000
+++ binutils/bfd/elfxx-mips.c 2017-02-02 00:56:23.581898707 +0000
@@ -3832,12 +3832,12 @@ mips_elf_sort_hash_table (bfd *abfd, str
struct mips_elf_hash_sort_data hsd;
struct mips_got_info *g;
- if (elf_hash_table (info)->dynsymcount == 0)
- return TRUE;
-
htab = mips_elf_hash_table (info);
BFD_ASSERT (htab != NULL);
+ if (elf_hash_table (info)->dynsymcount == 0)
+ return TRUE;
+
g = htab->got_info;
if (g == NULL)
return TRUE;