From 652b5afadb26cecf187afaa78fc82e94b7ad390d Mon Sep 17 00:00:00 2001 From: flobernd Date: Sun, 25 Jun 2017 23:49:19 +0200 Subject: [PATCH] Fixed operand-action for EVEX/MVEX instructions with write-mask --- src/Decoder.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Decoder.c b/src/Decoder.c index 7ba2580..f728493 100644 --- a/src/Decoder.c +++ b/src/Decoder.c @@ -1932,9 +1932,17 @@ FinalizeOperand: (info->operands[1].reg >= ZYDIS_REGISTER_K1) && (info->operands[1].reg <= ZYDIS_REGISTER_K7)) { - ZYDIS_ASSERT(info->operands[0].action == ZYDIS_OPERAND_ACTION_WRITE || - info->operands[0].action == ZYDIS_OPERAND_ACTION_READWRITE); - info->operands[0].action = ZYDIS_OPERAND_ACTION_READ_CONDWRITE; + switch (info->operands[0].action) + { + case ZYDIS_OPERAND_ACTION_WRITE: + info->operands[0].action = ZYDIS_OPERAND_ACTION_CONDWRITE; + break; + case ZYDIS_OPERAND_ACTION_READWRITE: + info->operands[0].action = ZYDIS_OPERAND_ACTION_READ_CONDWRITE; + break; + default: + ZYDIS_UNREACHABLE; + } } return ZYDIS_STATUS_SUCCESS;