dlltool fixes for commit 68bbe1183379
Alan Modra
amodra@gmail.com
Fri Oct 4 12:42:23 GMT 2024
For some reason, dlltool supports mcore-elf input files, and oss-fuzz
tests dlltool using mcore-elf. I'd guess fuzzed PE objects could hit
the same segfaults.
* dlltool.c (filter_symbols): Drop symbols with NULL names.
(identify_member_contains_symname): Don't consider symbols
with NULL names.
diff --git a/binutils/dlltool.c b/binutils/dlltool.c
index 9acd080b7b6..d6821caaf21 100644
--- a/binutils/dlltool.c
+++ b/binutils/dlltool.c
@@ -1539,7 +1539,7 @@ filter_symbols (bfd *abfd, void *minisyms, long symcount, unsigned int size)
|| bfd_is_com_section (sym->section))
&& ! bfd_is_und_section (sym->section));
- keep = keep && ! match_exclude (sym->name);
+ keep = keep && sym->name != NULL && !match_exclude (sym->name);
if (keep)
{
@@ -3197,9 +3197,10 @@ identify_member_contains_symname (bfd * abfd,
for (i = 0; i < number_of_symbols; i++)
{
- if (strncmp (symbol_table[i]->name,
- search_data->symname,
- strlen (search_data->symname)) == 0)
+ if (symbol_table[i]->name != NULL
+ && strncmp (symbol_table[i]->name,
+ search_data->symname,
+ strlen (search_data->symname)) == 0)
{
search_data->found = true;
break;
--
Alan Modra
More information about the Binutils
mailing list