From aa684c1bcc51b8b97256128612184b0cc8d44349 Mon Sep 17 00:00:00 2001 From: flobernd Date: Wed, 23 Mar 2016 18:06:42 +0100 Subject: [PATCH] Fixed invalid decoding of INSERTPS instruction closes #4 --- Zydis/ZydisInstructionDecoder.cpp | 4 ++-- Zydis/ZydisOpcodeTable.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Zydis/ZydisInstructionDecoder.cpp b/Zydis/ZydisInstructionDecoder.cpp index 3566aa9..e0b7654 100644 --- a/Zydis/ZydisInstructionDecoder.cpp +++ b/Zydis/ZydisInstructionDecoder.cpp @@ -578,7 +578,7 @@ bool InstructionDecoder::decodeOperand(InstructionInfo& info, OperandInfo& opera case DefinedOperandType::F: // TODO: FAR flag case DefinedOperandType::M: - // ModR/M byte may refer only to a register + // ModR/M byte may refer only to memory if (info.modrm_mod == 3) { info.flags |= IF_ERROR_OPERAND; @@ -638,7 +638,7 @@ bool InstructionDecoder::decodeOperand(InstructionInfo& info, OperandInfo& opera GetComplexOperandRegSize(operandSize) : GetComplexOperandMemSize(operandSize)); case DefinedOperandType::N: - // ModR/M byte may refer only to memory + // ModR/M byte may refer only to a register if (info.modrm_mod != 3) { info.flags |= IF_ERROR_OPERAND; diff --git a/Zydis/ZydisOpcodeTable.cpp b/Zydis/ZydisOpcodeTable.cpp index bac0710..7316fac 100644 --- a/Zydis/ZydisOpcodeTable.cpp +++ b/Zydis/ZydisOpcodeTable.cpp @@ -7558,7 +7558,7 @@ const InstructionDefinition instrDefinitions[] = /* 2B4 */ { InstructionMnemonic::INC, { OPI_R5z, OPI_NONE, OPI_NONE, OPI_NONE }, IDF_ACCEPTS_OPERAND_SIZE_PREFIX | IDF_OPERAND1_READWRITE }, /* 2B5 */ { InstructionMnemonic::INSB, { OPI_NONE, OPI_NONE, OPI_NONE, OPI_NONE }, IDF_ACCEPTS_REP_PREFIX |IDF_ACCEPTS_SEGMENT_PREFIX }, /* 2B6 */ { InstructionMnemonic::INSD, { OPI_NONE, OPI_NONE, OPI_NONE, OPI_NONE }, IDF_ACCEPTS_REP_PREFIX |IDF_ACCEPTS_OPERAND_SIZE_PREFIX | IDF_ACCEPTS_SEGMENT_PREFIX }, - /* 2B7 */ { InstructionMnemonic::INSERTPS, { OPI_V, OPI_Md, OPI_Ib, OPI_NONE }, IDF_ACCEPTS_ADDRESS_SIZE_PREFIX | IDF_ACCEPTS_REXR | IDF_ACCEPTS_REXW | IDF_ACCEPTS_REXX | IDF_ACCEPTS_REXB | IDF_OPERAND1_WRITE }, + /* 2B7 */ { InstructionMnemonic::INSERTPS, { OPI_V, OPI_W, OPI_Ib, OPI_NONE }, IDF_ACCEPTS_ADDRESS_SIZE_PREFIX | IDF_ACCEPTS_REXR | IDF_ACCEPTS_REXW | IDF_ACCEPTS_REXX | IDF_ACCEPTS_REXB | IDF_OPERAND1_WRITE }, /* 2B8 */ { InstructionMnemonic::INSW, { OPI_NONE, OPI_NONE, OPI_NONE, OPI_NONE }, IDF_ACCEPTS_REP_PREFIX |IDF_ACCEPTS_OPERAND_SIZE_PREFIX | IDF_ACCEPTS_SEGMENT_PREFIX }, /* 2B9 */ { InstructionMnemonic::INT, { OPI_Ib, OPI_NONE, OPI_NONE, OPI_NONE }, 0 }, /* 2BA */ { InstructionMnemonic::INT1, { OPI_NONE, OPI_NONE, OPI_NONE, OPI_NONE }, 0 },