capstone: only use insn.detail if it's not NULL
Capstone NULLs the detail field when it encounters a bad/invalid opcode. Change-Id: I421386903756e03049e950f09b8a500b54fe4a73
This commit is contained in:
@ -135,8 +135,10 @@ int CapstoneDisassembler::disassemble_section(Elf_Data *data, Elf32_Shdr *shdr32
|
||||
for (j = 0; j < count; j++) {
|
||||
unsigned int opcode = 0;
|
||||
if (m_elf->m_machine == EM_386 || m_elf->m_machine == EM_X86_64) {
|
||||
if (insn[j].detail) { // NULL if insn is broken
|
||||
opcode = (insn[j].detail->x86.opcode[3] << 24) | (insn[j].detail->x86.opcode[2] << 16) |
|
||||
(insn[j].detail->x86.opcode[1] << 8) | insn[j].detail->x86.opcode[0];
|
||||
}
|
||||
} else if (m_elf->m_machine == EM_ARM) {
|
||||
// placeholder
|
||||
opcode = 0;
|
||||
|
||||
Reference in New Issue
Block a user