Skip to content

Commit

Permalink
x86: LDS is invalid in x64. see capstone-engine#904
Browse files Browse the repository at this point in the history
  • Loading branch information
aquynh committed May 8, 2017
1 parent 2b84c0c commit 7ee4581
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions arch/X86/X86Disassembler.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 7ee4581

Please sign in to comment.