aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2021-07-03 09:41:31 -0700
committeriximeow <me@iximeow.net>2021-07-03 09:41:31 -0700
commit77efbb834a5119b93e656dce6189f36df89645bb (patch)
tree5b7db1be63a6a904e41748df71e17ebce06860b4
parent8b4de9092947380e8602766f64af4081c89b29d7 (diff)
reject instructions when their opcode is `Invalid`
the evex route would allow "valid" instructions that have the opcode `invalid`. this is.. not correct.
-rw-r--r--src/long_mode/display.rs5
-rw-r--r--src/long_mode/mod.rs2
-rw-r--r--src/shared/evex.in3
3 files changed, 4 insertions, 6 deletions
diff --git a/src/long_mode/display.rs b/src/long_mode/display.rs
index e60645b..049b96d 100644
--- a/src/long_mode/display.rs
+++ b/src/long_mode/display.rs
@@ -1806,11 +1806,6 @@ impl Opcode {
}
}
- // AVX512CD
-
-
- // MPX
-
impl <T: fmt::Write, Y: YaxColors> Colorize<T, Y> for Opcode {
fn colorize(&self, colors: &Y, out: &mut T) -> fmt::Result {
match self {
diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs
index 769706f..41e24e6 100644
--- a/src/long_mode/mod.rs
+++ b/src/long_mode/mod.rs
@@ -6967,7 +6967,7 @@ fn read_0f3a_opcode(opcode: u8, prefixes: &mut Prefixes) -> OpcodeRecord {
0x61 => OpcodeRecord(Interpretation::Instruction(Opcode::PCMPESTRI), OperandCode::G_E_xmm_Ib),
0x62 => OpcodeRecord(Interpretation::Instruction(Opcode::PCMPISTRM), OperandCode::G_E_xmm_Ib),
0x63 => OpcodeRecord(Interpretation::Instruction(Opcode::PCMPISTRI), OperandCode::G_E_xmm_Ib),
- 0xcc => OpcodeRecord(Interpretation::Instruction(Opcode::SHA1RNDS4), OperandCode::G_E_xmm_Ib),
+// 0xcc => OpcodeRecord(Interpretation::Instruction(Opcode::SHA1RNDS4), OperandCode::G_E_xmm_Ib),
0xce => OpcodeRecord(Interpretation::Instruction(Opcode::GF2P8AFFINEQB), OperandCode::G_E_xmm_Ub),
0xcf => OpcodeRecord(Interpretation::Instruction(Opcode::GF2P8AFFINEINVQB), OperandCode::G_E_xmm_Ub),
0xdf => OpcodeRecord(Interpretation::Instruction(Opcode::AESKEYGENASSIST), OperandCode::G_E_xmm_Ub),
diff --git a/src/shared/evex.in b/src/shared/evex.in
index 2bcd2f4..f9574db 100644
--- a/src/shared/evex.in
+++ b/src/shared/evex.in
@@ -86,6 +86,9 @@ pub(crate) fn read_evex<T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch a
}
instruction.prefixes.apply_compressed_disp(false);
}
+ if instruction.opcode == Opcode::Invalid {
+ return Err(DecodeError::InvalidOpcode);
+ }
// TODO: apply rp and bp?
} else {
return Err(DecodeError::InvalidOpcode);