diff options
author | iximeow <me@iximeow.net> | 2020-11-19 18:13:24 -0800 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2020-11-19 18:13:24 -0800 |
commit | 81e9b93aab9217cf7cb508f64b19fc1c0df024b5 (patch) | |
tree | 4a17eed4bd3191d3f02417d6c7d63420a474fb95 /test/long_mode/mod.rs | |
parent | e3a400b7a96284d1394cd710ea3bcee01dbfe95f (diff) |
fix decoding of rex-prefixed modrm+sib operands selecting index 0b100 and base 0b1010.1.4
for memory operands with a base, index, and displacement either
the wrong base would be selected (register number ignored, so only
`*ax` or `r8*` would be reported), or yaxpeax-x86 would report a
base register is present when it is not (`RegIndexBaseScaleDisp`
when the operand is actually `RegScaleDisp`)
thank you to Evan Johnson for catching and reporting this bug!
also bump crate version to 0.1.4 as this will be immediately tagged and
released.
Diffstat (limited to 'test/long_mode/mod.rs')
-rw-r--r-- | test/long_mode/mod.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/long_mode/mod.rs b/test/long_mode/mod.rs index 3b31dbb..8489822 100644 --- a/test/long_mode/mod.rs +++ b/test/long_mode/mod.rs @@ -109,6 +109,17 @@ fn test_modrm_decode() { test_display(&[0x41, 0x33, 0x84, 0xa5, 0x11, 0x22, 0x33, 0x44], "xor eax, [r13 + 0x44332211]"); test_display(&[0x33, 0x04, 0xe5, 0x11, 0x22, 0x33, 0x44], "xor eax, [0x44332211]"); test_display(&[0x41, 0x33, 0x04, 0xe5, 0x11, 0x22, 0x33, 0x44], "xor eax, [0x44332211]"); + + // specifically sib with base == 0b101 + // mod bits 00 + test_display(&[0x42, 0x33, 0x34, 0x25, 0x20, 0x30, 0x40, 0x50], "xor esi, [r12 * 1 + 0x50403020]"); + test_display(&[0x43, 0x33, 0x34, 0x25, 0x20, 0x30, 0x40, 0x50], "xor esi, [r12 * 1 + 0x50403020]"); + // mod bits 01 + test_display(&[0x42, 0x33, 0x74, 0x25, 0x20], "xor esi, [rbp + r12 * 1 + 0x20]"); + test_display(&[0x43, 0x33, 0x74, 0x25, 0x20], "xor esi, [r13 + r12 * 1 + 0x20]"); + // mod bits 10 + test_display(&[0x42, 0x33, 0xb4, 0x25, 0x20, 0x30, 0x40, 0x50], "xor esi, [rbp + r12 * 1 + 0x50403020]"); + test_display(&[0x43, 0x33, 0xb4, 0x25, 0x20, 0x30, 0x40, 0x50], "xor esi, [r13 + r12 * 1 + 0x50403020]"); } #[test] |