fix underflow

This commit is contained in:
Duncan Ogilvie 2019-09-07 17:42:52 +02:00
parent 9f0eae62c1
commit 7c4e7d7daf
1 changed files with 11 additions and 8 deletions

View File

@ -4535,14 +4535,17 @@ static ZydisStatus ZydisDecodeInstruction(ZydisDecoderContext* context,
break; break;
} }
ZYDIS_CHECK(ZydisDecodeOperands(context, instruction, definition)); ZYDIS_CHECK(ZydisDecodeOperands(context, instruction, definition));
if (instruction->operandCount)
{
const ZydisRegister reg = const ZydisRegister reg =
instruction->operands[instruction->operandCount - 1].reg.value; instruction->operands[instruction->operandCount - 1].reg.value;
if ((reg == ZYDIS_REGISTER_FLAGS ) || (reg == ZYDIS_REGISTER_EFLAGS) || if ((reg == ZYDIS_REGISTER_FLAGS) || (reg == ZYDIS_REGISTER_EFLAGS) ||
(reg == ZYDIS_REGISTER_RFLAGS)) (reg == ZYDIS_REGISTER_RFLAGS))
{ {
ZydisSetAccessedFlags(instruction, definition); ZydisSetAccessedFlags(instruction, definition);
} }
} }
}
return ZYDIS_STATUS_SUCCESS; return ZYDIS_STATUS_SUCCESS;
} }