Fix crash when disassembling invalid range on powerpc vle
authorLuis Machado <lgustavo@codesourcery.com>
Thu, 8 Dec 2016 13:25:09 +0000 (07:25 -0600)
committerLuis Machado <lgustavo@codesourcery.com>
Thu, 8 Dec 2016 13:25:09 +0000 (07:25 -0600)
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.

opcodes/ChangeLog
opcodes/ppc-dis.c

index ff9c689459f32866756b9a8e087af3f035747481..09f03419e2a9c914ca922c397b9f95ff721f5849 100644 (file)
@@ -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.
index da1301e6aeaf5c148e70f8eab618a6754bc87d4a..efca15771c57f1bd07cf98d5a43157fdc1adc85a 100644 (file)
@@ -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)
This page took 0.024898 seconds and 4 git commands to generate.