diff options
author | Nick Clifton <nickc@redhat.com> | 2018-04-17 17:47:51 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2018-04-17 17:47:51 +0100 |
commit | 808346fcfcff1c3f2471c98e48613afd7bce3679 (patch) | |
tree | 0a0fc7a563dabb064b5db4a2032ecf764e985513 /bfd/linker.c | |
parent | c4a91159afa222c1025f1535f42e382b91dc6b73 (diff) | |
download | binutils-gdb-808346fcfcff1c3f2471c98e48613afd7bce3679.tar.gz |
Fix illegal memory accesses trigeered when linking corrupt input files.
PR 23055
* aoutx.h (find_nearest_line): Check that the symbol name exists
and is long enough, before attempting to see if it is for a .o
file.
* hash.c (bfd_hash_hash): Add an assertion that the string is not
NULL.
* linker.c (bfd_link_hash_lookup): Fail if the table or string are
NULL.
(_bfd_generic_link_add_archive_symbols): Fail if an archive entry
has no name.
Diffstat (limited to 'bfd/linker.c')
-rw-r--r-- | bfd/linker.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/bfd/linker.c b/bfd/linker.c index c29a6e7e102..3019919a916 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -495,6 +495,9 @@ bfd_link_hash_lookup (struct bfd_link_hash_table *table, { struct bfd_link_hash_entry *ret; + if (table == NULL || string == NULL) + return NULL; + ret = ((struct bfd_link_hash_entry *) bfd_hash_lookup (&table->table, string, create, copy)); @@ -941,6 +944,9 @@ _bfd_generic_link_add_archive_symbols continue; } + if (arsym->name == NULL) + goto error_return; + h = bfd_link_hash_lookup (info->hash, arsym->name, FALSE, FALSE, TRUE); |