Fix a potential illegal memory access when testing for a special LTO symbol name.

bfd	* linker.c (_bfd_generic_link_add_one_symbol): Test for a NULL
	name before checking to see if the symbol is __gnu_lto_slim.
	* archive.c (_bfd_compute_and_write_armap): Likewise.
binutils
	* nm.c (filter_symbols): Test for a NULL name before checking to
	see if the symbol is __gnu_lto_slim.
	* objcopy.c (filter_symbols): Likewise.
This commit is contained in:
Nick Clifton
2021-10-19 16:02:49 +01:00
parent d4ef5e75c7
commit cf487499e0
6 changed files with 19 additions and 3 deletions

View File

@@ -1420,6 +1420,7 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
{
row = COMMON_ROW;
if (!bfd_link_relocatable (info)
&& name != NULL
&& name[0] == '_'
&& name[1] == '_'
&& strcmp (name + (name[2] == '_'), "__gnu_lto_slim") == 0)