aboutsummaryrefslogtreecommitdiff
path: root/bfd/syms.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2021-04-29 17:55:43 +0100
committerNick Clifton <nickc@redhat.com>2021-04-29 17:55:43 +0100
commit09e40e44ad05822ed72f6ad720b5e75ea2a8fc67 (patch)
tree5a6c2619aaeb62334cea7aaa6c7bf0b05f140c5e /bfd/syms.c
parent063e75c9e4307d21b787a71b6d5b61a2560f5073 (diff)
downloadgdb-09e40e44ad05822ed72f6ad720b5e75ea2a8fc67.zip
gdb-09e40e44ad05822ed72f6ad720b5e75ea2a8fc67.tar.gz
gdb-09e40e44ad05822ed72f6ad720b5e75ea2a8fc67.tar.bz2
Fix an access through a null pointer when parsing a corrupt SOM format fle.
PR 27793 * som.c (som_slurp_symbol_table): Assign symbols without any scope to the undefined section. (som_decode_symclass): Check for a missing symbol section. * syms.c (bfd_decode_symclass): Likewise.
Diffstat (limited to 'bfd/syms.c')
-rw-r--r--bfd/syms.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/bfd/syms.c b/bfd/syms.c
index e0ab167..7daf741 100644
--- a/bfd/syms.c
+++ b/bfd/syms.c
@@ -654,6 +654,10 @@ bfd_decode_symclass (asymbol *symbol)
{
char c;
+ /* Paranoia... */
+ if (symbol == NULL || symbol->section == NULL)
+ return '?';
+
if (symbol->section && bfd_is_com_section (symbol->section))
{
if (symbol->section->flags & SEC_SMALL_DATA)