aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorLuis Machado <luis.machado@arm.com>2022-11-02 07:17:46 +0000
committerLuis Machado <luis.machado@arm.com>2022-11-10 01:12:17 +0000
commit76a95facf1260326469dc9952adc6ee034bac735 (patch)
treefeb8bbca53d514179a7b3d6053da7423ef404909 /opcodes
parent94355de7751579b0182bd5821a3223939054f5d7 (diff)
downloadgdb-76a95facf1260326469dc9952adc6ee034bac735.zip
gdb-76a95facf1260326469dc9952adc6ee034bac735.tar.gz
gdb-76a95facf1260326469dc9952adc6ee034bac735.tar.bz2
[opcodes/arm] Fix potential null pointer dereferences
PR tdep/29598 As pointed out in the bug ticket, we have a couple potential null pointer dereferencing situations. Harden those. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29598
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/arm-dis.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c
index 47a0a38..8f29537 100644
--- a/opcodes/arm-dis.c
+++ b/opcodes/arm-dis.c
@@ -12484,6 +12484,10 @@ mapping_symbol_for_insn (bfd_vma pc, struct disassemble_info *info,
bool found = false;
bool can_use_search_opt_p = false;
+ /* Sanity check. */
+ if (info == NULL)
+ return false;
+
/* Default to DATA. A text section is required by the ABI to contain an
INSN mapping symbol at the start. A data section has no such
requirement, hence if no mapping symbol is found the section must
@@ -12497,7 +12501,7 @@ mapping_symbol_for_insn (bfd_vma pc, struct disassemble_info *info,
type = MAP_ARM;
struct arm_private_data *private_data;
- if (info->private_data == NULL
+ if (info->private_data == NULL || info->symtab == NULL
|| info->symtab_size == 0
|| bfd_asymbol_flavour (*info->symtab) != bfd_target_elf_flavour)
return false;