1
0
mirror of https://github.com/bitdefender/bddisasm.git synced 2025-01-21 20:40:58 +00:00

#82: Handle 0 in OpSize::from_raw

This commit is contained in:
Ionel-Cristinel ANICHITEI 2023-07-01 10:44:37 +03:00
parent 935e2dfe5b
commit fbb38f1518
4 changed files with 7 additions and 3 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "bddisasm-sys"
version = "0.2.1"
version = "0.3.0"
authors = ["Cristi Anichitei <ianichitei@bitdefender.com>"]
edition = "2018"
links = "bddisasm"

View File

@ -1,6 +1,6 @@
[package]
name = "bddisasm"
version = "0.2.2"
version = "0.3.0"
authors = ["Cristi Anichitei <ianichitei@bitdefender.com>"]
edition = "2018"
license = "Apache-2.0"
@ -14,7 +14,7 @@ categories = ["api-bindings", "hardware-support"]
keywords = ["disassembler", "decoder", "x86", "amd64", "x86_64"]
[dependencies]
bddisasm-sys = { version = "0.2.1", path = "../bddisasm-sys" }
bddisasm-sys = { version = "0.3.0", path = "../bddisasm-sys" }
[features]
std = []

View File

@ -1633,6 +1633,9 @@ mod tests {
evex_rounding += 1;
}
}
// There is no `ND_SIZE_*` macro for 0, but the size 0 is valid, so test it here.
assert_eq!(operand::OpSize::from_raw(0), Ok(operand::OpSize::Bytes(0)));
}
#[test]

View File

@ -620,6 +620,7 @@ impl fmt::Display for OpSize {
impl OpSize {
pub(crate) fn from_raw(value: ffi::ND_OPERAND_SIZE) -> Result<Self, DecodeError> {
match value {
0 => Ok(OpSize::Bytes(0)),
ffi::ND_SIZE_8BIT => Ok(OpSize::Bytes(1)),
ffi::ND_SIZE_16BIT => Ok(OpSize::Bytes(2)),
ffi::ND_SIZE_32BIT => Ok(OpSize::Bytes(4)),