aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorLuis Machado <lgustavo@codesourcery.com>2016-12-08 07:25:09 -0600
committerLuis Machado <lgustavo@codesourcery.com>2016-12-08 07:25:09 -0600
commit3a2488dd21a895df3ffb49048f5de1a83ce2ddd4 (patch)
treeb9cdc0db65991ed634a9cce1d039c0c628af88a4 /opcodes
parent1d262527cf7ef3cdd2c015dc3540b47996e94d37 (diff)
downloadgdb-3a2488dd21a895df3ffb49048f5de1a83ce2ddd4.zip
gdb-3a2488dd21a895df3ffb49048f5de1a83ce2ddd4.tar.gz
gdb-3a2488dd21a895df3ffb49048f5de1a83ce2ddd4.tar.bz2
Fix crash when disassembling invalid range on powerpc vle
I got a report of a gdb crash for vle and further investigation showed an attempt to disassemble an invalid memory range. I tracked the crash down to the code in get_powerpc_dialect, where we fail to make sure we have a valid section pointer before dereferencing it. There is no such problem for rs6000-based disassembling. opcodes/ChangeLog: 2016-12-08 Luis Machado <lgustavo@codesourcery.com> * ppc-dis.c (get_powerpc_dialect): Check NULL info->section.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog4
-rw-r--r--opcodes/ppc-dis.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index ff9c689..09f0341 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,7 @@
+2016-12-08 Luis Machado <lgustavo@codesourcery.com>
+
+ * ppc-dis.c (get_powerpc_dialect): Check NULL info->section.
+
2016-12-07 Maciej W. Rozycki <macro@imgtec.com>
* mips-dis.c (print_mips16_insn_arg): Fix comment typo.
diff --git a/opcodes/ppc-dis.c b/opcodes/ppc-dis.c
index da1301e..efca157 100644
--- a/opcodes/ppc-dis.c
+++ b/opcodes/ppc-dis.c
@@ -236,7 +236,7 @@ get_powerpc_dialect (struct disassemble_info *info)
/* Disassemble according to the section headers flags for VLE-mode. */
if (dialect & PPC_OPCODE_VLE
- && info->section->owner != NULL
+ && info->section != NULL && info->section->owner != NULL
&& bfd_get_flavour (info->section->owner) == bfd_target_elf_flavour
&& elf_object_id (info->section->owner) == PPC32_ELF_DATA
&& (elf_section_flags (info->section) & SHF_PPC_VLE) != 0)