aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2020-01-13 20:48:53 -0800
committeriximeow <me@iximeow.net>2020-01-13 20:48:53 -0800
commitb7ac0d56035dda259d9c666c03bc70ace5e58f41 (patch)
tree452f78d8a3d781d3af3c336f166f9fd110c148c9
parentf6ea2e4cb44c80ab19a92e6216d14223daf5841f (diff)
explicitly fail to handle WAIT prefix
-rw-r--r--src/lib.rs4
-rw-r--r--test/test.rs5
2 files changed, 8 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 500d59d..1530866 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -4696,6 +4696,10 @@ fn read_instr<T: Iterator<Item=u8>>(decoder: &InstDecoder, mut bytes_iter: T, in
0x67 => {
prefixes.set_address_size();
},
+ 0x9b => {
+ // TODO: WAIT prefix
+ return Err(DecodeError::IncompleteDecoder);
+ },
0xf0 => {
prefixes.set_lock();
},
diff --git a/test/test.rs b/test/test.rs
index 07d715c..8c8ad25 100644
--- a/test/test.rs
+++ b/test/test.rs
@@ -4,7 +4,7 @@ extern crate yaxpeax_x86;
use std::fmt::Write;
use yaxpeax_arch::{Decoder, LengthedInstruction};
-use yaxpeax_x86::{Instruction, InstDecoder};
+use yaxpeax_x86::{DecodeError, Instruction, InstDecoder};
fn test_invalid(data: &[u8]) {
test_invalid_under(&InstDecoder::default(), data);
@@ -374,6 +374,9 @@ fn test_prefixes() {
test_display(&[0x66, 0x41, 0x31, 0xc0], "xor r8w, ax");
test_display(&[0x66, 0x41, 0x32, 0xc0], "xor al, r8b");
test_display(&[0x40, 0x32, 0xc5], "xor al, bpl");
+
+ // test that WAIT doesn't blow up, at least...
+ assert_eq!(InstDecoder::default().decode([0x9b, 0xf8].iter().cloned()).err(), Some(DecodeError::IncompleteDecoder));
}
#[test]