[PATCH] ld: Fix segfault in populate_publics_stream

Jan Beulich jbeulich@suse.com
Mon Nov 28 14:54:08 GMT 2022


On 27.11.2022 03:38, Mark Harmstone wrote:
> --- a/ld/pdb.c
> +++ b/ld/pdb.c
> @@ -1413,6 +1413,9 @@ populate_publics_stream (bfd *stream, bfd *abfd, bfd *sym_rec_stream)

Out of curiosity - which tree was this diff generated against? The
line number here looks to be off by several hundred from what I
see in the repo right now.

>    for (bfd *in = coff_data (abfd)->link_info->input_bfds; in;
>         in = in->link.next)
>      {
> +      if (!in->outsymbols)
> +	continue;
> +
>        for (unsigned int i = 0; i < in->symcount; i++)
>  	{
>  	  struct bfd_symbol *sym = in->outsymbols[i];

Why / when would in->outsymbols be NULL but in->symcount be non-zero?
And if that was possible, why would it not also be possible that the
array is smaller than in->symcount? (This is the kind of questions
which arise when there's no description at all for a patch. Such a
description could have clarified under what special conditions a NULL
deref could happen despite it not being obviously possible.)

Jan


More information about the Binutils mailing list