PR22887, null pointer dereference in aout_32_swap_std_reloc_out

PR 22887
	* aoutx.h (swap_std_reloc_in): Correct r_index bound check.
This commit is contained in:
Alan Modra 2018-02-28 22:09:50 +10:30
parent 889be5dbd2
commit 116acb2c26
2 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2018-02-28 Alan Modra <amodra@gmail.com>
PR 22887
* aoutx.h (swap_std_reloc_in): Correct r_index bound check.
2018-02-28 Nick Clifton <nickc@redhat.com>
PR 22894

View File

@ -2289,10 +2289,12 @@ NAME (aout, swap_std_reloc_in) (bfd *abfd,
if (r_baserel)
r_extern = 1;
if (r_extern && r_index > symcount)
if (r_extern && r_index >= symcount)
{
/* We could arrange to return an error, but it might be useful
to see the file even if it is bad. */
to see the file even if it is bad. FIXME: Of course this
means that objdump -r *doesn't* see the actual reloc, and
objcopy silently writes a different reloc. */
r_extern = 0;
r_index = N_ABS;
}