Be more restrictive about VEX prefix combinations
This commit is contained in:
4
decode.c
4
decode.c
@@ -131,6 +131,10 @@ decode_prefixes(const uint8_t* buffer, int len, DecodeMode mode,
|
|||||||
if (mode == DECODE_32 && (byte & 0xc0) != 0xc0)
|
if (mode == DECODE_32 && (byte & 0xc0) != 0xc0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
// VEX + REX/66/F2/F3/LOCK will #UD.
|
||||||
|
if (prefixes & (PREFIX_REX|PREFIX_REP|PREFIX_REPNZ|PREFIX_LOCK))
|
||||||
|
return -1;
|
||||||
|
|
||||||
prefixes |= PREFIX_VEX;
|
prefixes |= PREFIX_VEX;
|
||||||
prefixes |= byte & 0x80 ? 0 : PREFIX_REXR;
|
prefixes |= byte & 0x80 ? 0 : PREFIX_REXR;
|
||||||
if (prefix == 0xc4) // 3-byte VEX
|
if (prefix == 0xc4) // 3-byte VEX
|
||||||
|
|||||||
Reference in New Issue
Block a user