aboutsummaryrefslogtreecommitdiff
path: root/opcodes/aarch64-dis.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2020-08-21 15:32:20 +0100
committerNick Clifton <nickc@redhat.com>2020-08-21 15:32:20 +0100
commitccf61261eb8cce869ae4452de547a5f3afb074e4 (patch)
tree1f084a53751b79a65fb94a37f80ef74084c76c86 /opcodes/aarch64-dis.c
parent02391b8be4fcb3366c23ed53e7e9aaeef734f78d (diff)
downloadgdb-ccf61261eb8cce869ae4452de547a5f3afb074e4.zip
gdb-ccf61261eb8cce869ae4452de547a5f3afb074e4.tar.gz
gdb-ccf61261eb8cce869ae4452de547a5f3afb074e4.tar.bz2
Fix problems with the AArch64 linker exposed by testing it with sanitization enabled.
bfd * elfnn-aarch64.c (_bfd_aarch64_erratum_835769_scan): Only sort the data map if there are entries in it. (_bfd_aarch64_erratum_843419_scan): Likewise. opcodes * aarch64-dis.c (get_sym_code_type): Return FALSE for non-ELF symbols.
Diffstat (limited to 'opcodes/aarch64-dis.c')
-rw-r--r--opcodes/aarch64-dis.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/opcodes/aarch64-dis.c b/opcodes/aarch64-dis.c
index 6567880..326fabb 100644
--- a/opcodes/aarch64-dis.c
+++ b/opcodes/aarch64-dis.c
@@ -3321,6 +3321,7 @@ static int
get_sym_code_type (struct disassemble_info *info, int n,
enum map_type *map_type)
{
+ asymbol * as;
elf_symbol_type *es;
unsigned int type;
const char *name;
@@ -3329,7 +3330,14 @@ get_sym_code_type (struct disassemble_info *info, int n,
if (info->section != NULL && info->section != info->symtab[n]->section)
return FALSE;
- es = *(elf_symbol_type **)(info->symtab + n);
+ if (n >= info->symtab_size)
+ return FALSE;
+
+ as = info->symtab[n];
+ if (bfd_asymbol_flavour (as) != bfd_target_elf_flavour)
+ return FALSE;
+ es = (elf_symbol_type *) as;
+
type = ELF_ST_TYPE (es->internal_elf_sym.st_info);
/* If the symbol has function type then use that. */