[PATCH 3/3] ld: Cleanup sframe_decoder_init_func_bfdinfo use of cookie->rel

Hans-Peter Nilsson hp@bitrange.com
Mon Feb 24 17:44:21 GMT 2025


Random spotting, actually in the other recent comment:

On Fri, 21 Feb 2025, Jens Remus wrote:
> diff --git a/bfd/elf-sframe.c b/bfd/elf-sframe.c
> index 67ed874e0252..db166d485f9e 100644
> --- a/bfd/elf-sframe.c
> +++ b/bfd/elf-sframe.c
> @@ -118,9 +118,9 @@ sframe_decoder_init_func_bfdinfo (bfd *abfd,
>    if ((sec->flags & SEC_LINKER_CREATED) && cookie->rels == NULL)
>      return true;
>  
> +  cookie->rel = cookie->rels;
>    for (i = 0; i < fde_count; i++)
>      {
> -      cookie->rel = cookie->rels + i;
>        BFD_ASSERT (cookie->rel < cookie->relend);

That BFD_ASSERT looks like it should be updated or moved after 
that change, or else it won't work as a kind of bounds-check 
within the loop.

brgds, H-P


More information about the Binutils mailing list