Reject invalid VEX encodings
This commit is contained in:
11
decode.c
11
decode.c
@@ -389,7 +389,12 @@ fd_decode(const uint8_t* buffer, size_t len_sz, int mode_int, uintptr_t address,
|
|||||||
prefixes &= ~(PREFIX_OPSZ | PREFIX_REPNZ | PREFIX_REP);
|
prefixes &= ~(PREFIX_OPSZ | PREFIX_REPNZ | PREFIX_REP);
|
||||||
ENTRY_UNPACK(table, kind, table[index]);
|
ENTRY_UNPACK(table, kind, table[index]);
|
||||||
}
|
}
|
||||||
else if (kind == ENTRY_TABLE_PREFIX_REP)
|
else if (prefixes & PREFIX_VEX)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kind == ENTRY_TABLE_PREFIX_REP)
|
||||||
{
|
{
|
||||||
// Discard 66h mandatory prefix
|
// Discard 66h mandatory prefix
|
||||||
uint8_t index = mandatory_prefix != 1 ? mandatory_prefix : 0;
|
uint8_t index = mandatory_prefix != 1 ? mandatory_prefix : 0;
|
||||||
@@ -491,6 +496,10 @@ fd_decode(const uint8_t* buffer, size_t len_sz, int mode_int, uintptr_t address,
|
|||||||
operand->type = FD_OT_REG;
|
operand->type = FD_OT_REG;
|
||||||
operand->reg = vex_operand;
|
operand->reg = vex_operand;
|
||||||
}
|
}
|
||||||
|
else if (vex_operand != 0)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t imm_control = DESC_IMM_CONTROL(desc);
|
uint32_t imm_control = DESC_IMM_CONTROL(desc);
|
||||||
if (imm_control == 1)
|
if (imm_control == 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user