This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH 2/6] PR binutils/22875: FRV/ELF: Prevent an out-of-bounds howto table access
- From: Alan Modra <amodra at gmail dot com>
- To: "Maciej W. Rozycki" <macro at mips dot com>
- Cc: Nick Clifton <nickc at redhat dot com>, Dave Brolley <brolley at redhat dot com>, Alexandre Oliva <aoliva at redhat dot com>, binutils at sourceware dot org
- Date: Fri, 30 Mar 2018 23:07:48 +1030
- Subject: Re: [PATCH 2/6] PR binutils/22875: FRV/ELF: Prevent an out-of-bounds howto table access
- References: <alpine.DEB.2.00.1803282251560.2163@tp.orcam.me.uk> <alpine.DEB.2.00.1803291444260.2163@tp.orcam.me.uk>
On Thu, Mar 29, 2018 at 06:32:29PM +0100, Maciej W. Rozycki wrote:
> Prevent an out-of-bounds `elf32_frv_howto_table' table access in
> `frv_info_to_howto_rela' and redefine R_FRV_max to hold the number of
> entries in the contiguous regular FRV relocation range defined and
> described in the table, keeping the definitions of R_FRV_GNU_VTINHERIT
> and R_FRV_GNU_VTENTRY as outliers.
>
> include/
> * elf/frv.h (R_FRV_max): Redefine as `R_FRV_TLSMOFF + 1'.
I think it would be better to leave R_FRV_max unchanged and change the
single use of R_FRV_max to "sizeof (elf32_frv_howto_table)
/ sizeof (elf32_frv_howto_table[0])". Or include libiberty.h and use
ARRAY_SIZE.
That way the next time I look at include/elf/frv.h I won't wonder why
R_FRV_max is defined rather oddly, questioning why it isn't the
highest defined reloc plus one, and when looking at elf32-frv.c I
won't need to check that R_FRV_max is correct.
The same comment applies to the other R_*_max patches.
--
Alan Modra
Australia Development Lab, IBM