From 7ee458116022fda3fc30299fa51a9fee56dc6e5d Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Mon, 8 May 2017 10:49:16 +0800 Subject: [PATCH] x86: LDS is invalid in x64. see #904 --- arch/X86/X86Disassembler.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/X86/X86Disassembler.c b/arch/X86/X86Disassembler.c index c331902f28..0a13a6e6a7 100644 --- a/arch/X86/X86Disassembler.c +++ b/arch/X86/X86Disassembler.c @@ -973,10 +973,14 @@ bool X86_getInstruction(csh ud, const uint8_t *code, size_t code_len, result = (!translateInstruction(instr, &insn)) ? true : false; if (result) { // quick fix for #904. TODO: fix this properly in the next update - if (handle->mode & CS_MODE_64 && - (instr->Opcode == X86_LES16rm || instr->Opcode == X86_LES32rm)) - // LES is invalid in x64 - return false; + if (handle->mode & CS_MODE_64) { + if (instr->Opcode == X86_LES16rm || instr->Opcode == X86_LES32rm) + // LES is invalid in x64 + return false; + if (instr->Opcode == X86_LDS16rm || instr->Opcode == X86_LDS32rm) + // LDS is invalid in x64 + return false; + } instr->imm_size = insn.immSize; if (handle->detail) {