This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] Fix crash when disassembling invalid range on powerpc vle
- From: Luis Machado <lgustavo at codesourcery dot com>
- To: <binutils at sourceware dot org>
- Date: Thu, 8 Dec 2016 00:23:48 -0600
- Subject: [PATCH] Fix crash when disassembling invalid range on powerpc vle
- Authentication-results: sourceware.org; auth=none
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.
The following patch fixes this.
OK?
opcodes/ChangeLog:
2016-12-08 Luis Machado <lgustavo@codesourcery.com>
* ppc-dis.c (get_powerpc_dialect): Check NULL info->section.
---
opcodes/ppc-dis.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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)
--
2.7.4