mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-08 08:33:13 +00:00
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.
This commit is contained in:
@@ -1,5 +1,16 @@
|
|||||||
2018-04-17 Nick Clifton <nickc@redhat.com>
|
2018-04-17 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
PR 23065
|
PR 23065
|
||||||
* dwarf2.c (concat_filename): Check for a NULL table pointer.
|
* dwarf2.c (concat_filename): Check for a NULL table pointer.
|
||||||
|
|
||||||
|
|||||||
@@ -2723,7 +2723,10 @@ NAME (aout, find_nearest_line) (bfd *abfd,
|
|||||||
const char *symname;
|
const char *symname;
|
||||||
|
|
||||||
symname = q->symbol.name;
|
symname = q->symbol.name;
|
||||||
if (strcmp (symname + strlen (symname) - 2, ".o") == 0)
|
|
||||||
|
if (symname != NULL
|
||||||
|
&& strlen (symname) > 2
|
||||||
|
&& strcmp (symname + strlen (symname) - 2, ".o") == 0)
|
||||||
{
|
{
|
||||||
if (q->symbol.value > low_line_vma)
|
if (q->symbol.value > low_line_vma)
|
||||||
{
|
{
|
||||||
@@ -2788,8 +2791,8 @@ NAME (aout, find_nearest_line) (bfd *abfd,
|
|||||||
case N_FUN:
|
case N_FUN:
|
||||||
{
|
{
|
||||||
/* We'll keep this if it is nearer than the one we have already. */
|
/* We'll keep this if it is nearer than the one we have already. */
|
||||||
if (q->symbol.value >= low_func_vma &&
|
if (q->symbol.value >= low_func_vma
|
||||||
q->symbol.value <= offset)
|
&& q->symbol.value <= offset)
|
||||||
{
|
{
|
||||||
low_func_vma = q->symbol.value;
|
low_func_vma = q->symbol.value;
|
||||||
func = (asymbol *)q;
|
func = (asymbol *)q;
|
||||||
|
|||||||
@@ -435,6 +435,7 @@ bfd_hash_hash (const char *string, unsigned int *lenp)
|
|||||||
unsigned int len;
|
unsigned int len;
|
||||||
unsigned int c;
|
unsigned int c;
|
||||||
|
|
||||||
|
BFD_ASSERT (string != NULL);
|
||||||
hash = 0;
|
hash = 0;
|
||||||
len = 0;
|
len = 0;
|
||||||
s = (const unsigned char *) string;
|
s = (const unsigned char *) string;
|
||||||
|
|||||||
@@ -495,6 +495,9 @@ bfd_link_hash_lookup (struct bfd_link_hash_table *table,
|
|||||||
{
|
{
|
||||||
struct bfd_link_hash_entry *ret;
|
struct bfd_link_hash_entry *ret;
|
||||||
|
|
||||||
|
if (table == NULL || string == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
ret = ((struct bfd_link_hash_entry *)
|
ret = ((struct bfd_link_hash_entry *)
|
||||||
bfd_hash_lookup (&table->table, string, create, copy));
|
bfd_hash_lookup (&table->table, string, create, copy));
|
||||||
|
|
||||||
@@ -941,6 +944,9 @@ _bfd_generic_link_add_archive_symbols
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (arsym->name == NULL)
|
||||||
|
goto error_return;
|
||||||
|
|
||||||
h = bfd_link_hash_lookup (info->hash, arsym->name,
|
h = bfd_link_hash_lookup (info->hash, arsym->name,
|
||||||
FALSE, FALSE, TRUE);
|
FALSE, FALSE, TRUE);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user