diff options
author | Alan Modra <amodra@gmail.com> | 2020-04-17 08:29:15 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-04-17 10:56:01 +0930 |
commit | 8d55d10ac0d112c586eaceb92e75bd9b80aadcc4 (patch) | |
tree | 74c0545882d7abc3d8c55495c738926738fac3d2 /bfd | |
parent | ca3f923f82a079dcf441419f4a50a50f8b4b33c2 (diff) | |
download | gdb-8d55d10ac0d112c586eaceb92e75bd9b80aadcc4.zip gdb-8d55d10ac0d112c586eaceb92e75bd9b80aadcc4.tar.gz gdb-8d55d10ac0d112c586eaceb92e75bd9b80aadcc4.tar.bz2 |
PR25842, Null pointer dereference in nm-new
PR 25842
* elf.c (_bfd_elf_get_symbol_version_string): Don't segfault on
NULL nodename.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elf.c | 8 |
2 files changed, 12 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 7f361d7..b9ee795 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2020-04-17 Alan Modra <amodra@gmail.com> + + PR 25842 + * elf.c (_bfd_elf_get_symbol_version_string): Don't segfault on + NULL nodename. + 2020-04-16 Nick Clifton <nickc@redhat.com> PR 25803 @@ -1911,8 +1911,12 @@ _bfd_elf_get_symbol_version_string (bfd *abfd, asymbol *symbol, { const char *nodename = elf_tdata (abfd)->verdef[vernum - 1].vd_nodename; - version_string = ((base_p || strcmp (symbol->name, nodename)) - ? nodename : ""); + version_string = ""; + if (base_p + || nodename == NULL + || symbol->name == NULL + || strcmp (symbol->name, nodename) != 0) + version_string = nodename; } else { |