aboutsummaryrefslogtreecommitdiff
path: root/bfd/archive.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2021-10-19 16:02:49 +0100
committerNick Clifton <nickc@redhat.com>2021-10-19 16:02:49 +0100
commitcf487499e0d7ef64ab63d6c76bf298bfaf64b980 (patch)
tree122027a0a59f41ba89e2cd5c5a991a0cf2e76f6f /bfd/archive.c
parentd4ef5e75c7ebf57b946f59ce85568b9c459a02f4 (diff)
downloadgdb-cf487499e0d7ef64ab63d6c76bf298bfaf64b980.zip
gdb-cf487499e0d7ef64ab63d6c76bf298bfaf64b980.tar.gz
gdb-cf487499e0d7ef64ab63d6c76bf298bfaf64b980.tar.bz2
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.
Diffstat (limited to 'bfd/archive.c')
-rw-r--r--bfd/archive.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bfd/archive.c b/bfd/archive.c
index 2ac680d..dc17356 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -2357,7 +2357,8 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
map = new_map;
}
- if (syms[src_count]->name[0] == '_'
+ if (syms[src_count]->name != NULL
+ && syms[src_count]->name[0] == '_'
&& syms[src_count]->name[1] == '_'
&& strcmp (syms[src_count]->name
+ (syms[src_count]->name[2] == '_'),