aboutsummaryrefslogtreecommitdiff
path: root/src/long_mode/mod.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2020-08-02 21:20:27 -0700
committeriximeow <me@iximeow.net>2020-08-09 01:38:57 -0700
commit1683b7af689b021946d1d869bf32ad95934639f2 (patch)
tree3dbb7b7696aca8d6bcb876e348951a47d44e7396 /src/long_mode/mod.rs
parentaa3df6a360551c2a770863c4324101db7b22f79f (diff)
correctly handle some more invalid opcode scenarios
Diffstat (limited to 'src/long_mode/mod.rs')
-rw-r--r--src/long_mode/mod.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs
index ef7f8c9..18b9f7b 100644
--- a/src/long_mode/mod.rs
+++ b/src/long_mode/mod.rs
@@ -5643,6 +5643,9 @@ fn read_instr<T: Iterator<Item=u8>>(decoder: &InstDecoder, mut bytes_iter: T, in
} else {
unsafe { unreachable_unchecked(); }
}
+ if instruction.opcode == Opcode::Invalid && record.1 == OperandCode::Nothing {
+ return Err(DecodeError::InvalidOpcode);
+ }
instruction.prefixes = prefixes;
read_operands(decoder, bytes_iter, instruction, record.1, &mut length)?;
instruction.length = length;
@@ -8336,6 +8339,9 @@ fn decode_x87<T: Iterator<Item=u8>>(_decoder: &InstDecoder, mut bytes_iter: T, i
}
};
instruction.opcode = opcode;
+ if instruction.opcode == Opcode::Invalid {
+ return Err(DecodeError::InvalidOpcode);
+ }
// TODO: support 80-bit operands
match x87_operands {
OperandCodeX87::Est => {