[PATCH] gold: fix crash for empty file
Martin Liška
mliska@suse.cz
Thu Jan 6 08:35:24 GMT 2022
On 1/5/22 18:35, Cary Coutant wrote:
>>>> @@ -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;
>
> I'm more concerned with why a NULL name got passed to lookup in the
> first place. In this test case, it's because parameters->entry() is
> returning NULL, which in turn is because no (valid) object files have
> been named, so a target hasn't been determined. I'd be more
> comfortable with maintaining the requirement of passing a non-null
> name to Symbol_table::lookup() (perhaps even adding an assert to that
> effect), and then fixing Plugin_hook::run() to check for NULL before
> calling lookup.
Sure, I must confess I don't know gold enough. Thus, leaving that to you.
Cheers,
Martin
>
> -cary
More information about the Binutils
mailing list