From 2e1d04568c85d2508b38ad2946780ae1c2446cfe Mon Sep 17 00:00:00 2001 From: Peter Waller Date: Fri, 17 Mar 2017 22:09:38 +0000 Subject: ifuzz: fix 2-byte vex decoding The intel documentation states, in section: 2.3.6 "Instruction Operand Encoding and VEX.vvvv, ModR/M" The following: "VEX.m-mmmm is only available on the 3-byte VEX. The 2-byte VEX implies a leading 0Fh opcode byte." This lead the decode function to reject the following as an unknown instruction: "c5 f9 6e c1 vmovd %ecx,%xmm0" With this fix, it correctly decodes it as a 4 byte instruction. --- ifuzz/decode.go | 1 + 1 file changed, 1 insertion(+) diff --git a/ifuzz/decode.go b/ifuzz/decode.go index a0f087522..472b2e5c8 100644 --- a/ifuzz/decode.go +++ b/ifuzz/decode.go @@ -47,6 +47,7 @@ func Decode(mode int, text []byte) (int, error) { prefixLen = 3 if text[0] == 0xc5 { prefixLen = 2 + vexMap = 1 // V0F } if len(text) < prefixLen { return 0, fmt.Errorf("bad VEX/XOP prefix") -- cgit mrf-deployment