[PATCH] gold: fix crash for empty file

Martin Liška mliska@suse.cz
Mon Nov 29 09:00:07 GMT 2021


PING^1

On 11/19/21 15:01, Martin Liška wrote:
> Hi.
> 
> The patch fixes a crash I noticed and explained in the linked PR.
> 
> Patch survives regression tests.
> 
> Ready to be installed?
> Thanks,
> Martin
> 
> gold/ChangeLog:
> 
>      PR 28585
>      * symtab.cc (Symbol_table::lookup): Return NULL for NULL
>      argument.
> ---
>   gold/symtab.cc | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/gold/symtab.cc b/gold/symtab.cc
> index 5a21ddc8cc2..ed6b5434592 100644
> --- a/gold/symtab.cc
> +++ b/gold/symtab.cc
> @@ -701,6 +701,8 @@ Symbol_table::resolve_forwards(const Symbol* from) const
>   Symbol*
>   Symbol_table::lookup(const char* name, const char* version) const
>   {
> +  if (name == NULL)
> +    return NULL;
>     Stringpool::Key name_key;
>     name = this->namepool_.find(name, &name_key);
>     if (name == NULL)



More information about the Binutils mailing list