diff options
| author | Samuel Arnold <samuel.arnold@crowdstrike.com> | 2026-06-12 17:30:30 -0700 |
|---|---|---|
| committer | iximeow <me@iximeow.net> | 2026-06-21 16:38:50 +0000 |
| commit | 2146ee62c265cd13ebcc1aaef138dd9e1aec4b72 (patch) | |
| tree | 1b52e2a66593ee0b2299d39ff1e7845c8f5c3392 | |
| parent | 8fd69da964e1e2056fd3ba2bb4ec8927340b82c6 (diff) | |
Make invalid instruction constructors actually return invalid instructionsHEADno-gods-no-
As opposed to nops.
| -rw-r--r-- | CHANGELOG | 9 | ||||
| -rw-r--r-- | src/long_mode/mod.rs | 2 | ||||
| -rw-r--r-- | src/protected_mode/mod.rs | 2 | ||||
| -rw-r--r-- | src/real_mode/mod.rs | 2 |
4 files changed, 12 insertions, 3 deletions
@@ -1,3 +1,12 @@ +## 2.2.0 + +* `Instruction::invalid()` returns instructions with opcode `Opcode::Invalid`, rather than nop. + decoding an instruction with `opcode == Invalid` was already possible through attempting + to decode invalid opcodes into a `&mut Instruction`; `invalid()` returning a no-operand + nop dates back to initial versions of the library attempting to never return instructions + that did not reflect a decoded x86 instruction. + it has long passed its time. thank you for the patch, @Grond66! + ## 2.1.1 * fix jrcxz/jecxz/jcxz having "two operands". accessing the "second" operand diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs index ca2e7cb..b7daa4a 100644 --- a/src/long_mode/mod.rs +++ b/src/long_mode/mod.rs @@ -3283,7 +3283,7 @@ impl Instruction { pub fn invalid() -> Instruction { Instruction { prefixes: Prefixes::new(0), - opcode: Opcode::NOP, + opcode: Opcode::Invalid, mem_size: 0, regs: [RegSpec::rax(); 4], scale: 0, diff --git a/src/protected_mode/mod.rs b/src/protected_mode/mod.rs index 6a1d19b..64c1c8d 100644 --- a/src/protected_mode/mod.rs +++ b/src/protected_mode/mod.rs @@ -3213,7 +3213,7 @@ impl Instruction { pub fn invalid() -> Instruction { Instruction { prefixes: Prefixes::new(0), - opcode: Opcode::NOP, + opcode: Opcode::Invalid, mem_size: 0, regs: [RegSpec::eax(); 4], scale: 0, diff --git a/src/real_mode/mod.rs b/src/real_mode/mod.rs index f54533c..3a7cbd3 100644 --- a/src/real_mode/mod.rs +++ b/src/real_mode/mod.rs @@ -3240,7 +3240,7 @@ impl Instruction { pub fn invalid() -> Instruction { Instruction { prefixes: Prefixes::new(0), - opcode: Opcode::NOP, + opcode: Opcode::Invalid, mem_size: 0, regs: [RegSpec::ax(); 4], scale: 0, |
