diff options
author | iximeow <me@iximeow.net> | 2024-06-23 23:13:03 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2024-06-23 23:25:46 -0700 |
commit | 238d65c98b2983f87c89f78a793ba7c56dcf7b01 (patch) | |
tree | ca2d08b8c60c6fbe635ca886f85e77ead5571078 | |
parent | 577b8e89849db33427e4be961997ad7af5e048f1 (diff) |
update yaxpeax-arch to 0.3.1, fix fuzz target warnings
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | ffi/long_mode/Cargo.toml | 2 | ||||
-rw-r--r-- | ffi/multiarch/Cargo.toml | 2 | ||||
-rw-r--r-- | ffi/protected_mode/Cargo.toml | 2 | ||||
-rw-r--r-- | ffi/real_mode/Cargo.toml | 2 | ||||
-rw-r--r-- | fuzz/Cargo.toml | 8 | ||||
-rw-r--r-- | fuzz/fuzz_targets/decode_does_not_panic.rs | 6 | ||||
-rw-r--r-- | fuzz/fuzz_targets/displaysink_used_correctly.rs | 24 | ||||
-rw-r--r-- | fuzz/fuzz_targets/small_reg_is_always_old_bank_if_possible.rs | 4 |
9 files changed, 42 insertions, 10 deletions
@@ -10,7 +10,7 @@ readme = "README.md" edition = "2018" [dependencies] -yaxpeax-arch = { version = "0.2.7", default-features = false, features = [] } +yaxpeax-arch = { version = "0.3.1", default-features = false, features = [] } "num-traits" = { version = "0.2", default-features = false } "serde" = { version = "1.0", optional = true } "serde_json" = { version = "1.0", optional = true } diff --git a/ffi/long_mode/Cargo.toml b/ffi/long_mode/Cargo.toml index 2df8450..0b6a529 100644 --- a/ffi/long_mode/Cargo.toml +++ b/ffi/long_mode/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [dependencies] yaxpeax-x86 = { path = "../../", default-features = false } -yaxpeax-arch = { version = "0.2.7", default-features = false } +yaxpeax-arch = { version = "0.3.1", default-features = false } [lib] name = "yaxpeax_x86_ffi_long_mode" diff --git a/ffi/multiarch/Cargo.toml b/ffi/multiarch/Cargo.toml index c15efbb..1e2cd2d 100644 --- a/ffi/multiarch/Cargo.toml +++ b/ffi/multiarch/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [dependencies] yaxpeax-x86 = { path = "../../", default-features = false } -yaxpeax-arch = { version = "0.2.7", default-features = false } +yaxpeax-arch = { version = "0.3.1", default-features = false } [lib] name = "yaxpeax_x86_ffi_multiarch" diff --git a/ffi/protected_mode/Cargo.toml b/ffi/protected_mode/Cargo.toml index 711845e..ef99a39 100644 --- a/ffi/protected_mode/Cargo.toml +++ b/ffi/protected_mode/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [dependencies] yaxpeax-x86 = { path = "../../", default-features = false } -yaxpeax-arch = { version = "0.2.7", default-features = false } +yaxpeax-arch = { version = "0.3.1", default-features = false } [lib] name = "yaxpeax_x86_ffi_protected_mode" diff --git a/ffi/real_mode/Cargo.toml b/ffi/real_mode/Cargo.toml index 689472e..c079e0e 100644 --- a/ffi/real_mode/Cargo.toml +++ b/ffi/real_mode/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [dependencies] yaxpeax-x86 = { path = "../../", default-features = false } -yaxpeax-arch = { version = "0.2.7", default-features = false } +yaxpeax-arch = { version = "0.3.1", default-features = false } [lib] name = "yaxpeax_x86_ffi_real_mode" diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index 60690f6..2203dc3 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -10,6 +10,8 @@ cargo-fuzz = true [dependencies.yaxpeax-x86] path = ".." +[dependencies.yaxpeax-arch] +version = "0.3.1" [dependencies.libfuzzer-sys] git = "https://github.com/rust-fuzz/libfuzzer-sys.git" @@ -28,6 +30,12 @@ test = false doc = false [[bin]] +name = "displaysink_used_correctly" +path = "fuzz_targets/displaysink_used_correctly.rs" +test = false +doc = false + +[[bin]] name = "display_c_does_not_panic" path = "fuzz_targets/display_c_does_not_panic.rs" test = false diff --git a/fuzz/fuzz_targets/decode_does_not_panic.rs b/fuzz/fuzz_targets/decode_does_not_panic.rs index 5e6c15d..fd6efec 100644 --- a/fuzz/fuzz_targets/decode_does_not_panic.rs +++ b/fuzz/fuzz_targets/decode_does_not_panic.rs @@ -6,7 +6,7 @@ fuzz_target!(|data: &[u8]| { let x86_64_decoder = yaxpeax_x86::long_mode::InstDecoder::default(); let x86_32_decoder = yaxpeax_x86::protected_mode::InstDecoder::default(); let x86_16_decoder = yaxpeax_x86::real_mode::InstDecoder::default(); - drop(x86_64_decoder.decode_slice(data)); - drop(x86_32_decoder.decode_slice(data)); - drop(x86_16_decoder.decode_slice(data)); + x86_64_decoder.decode_slice(data).expect("is ok"); + x86_32_decoder.decode_slice(data).expect("is ok"); + x86_16_decoder.decode_slice(data).expect("is ok"); }); diff --git a/fuzz/fuzz_targets/displaysink_used_correctly.rs b/fuzz/fuzz_targets/displaysink_used_correctly.rs new file mode 100644 index 0000000..bd8d1db --- /dev/null +++ b/fuzz/fuzz_targets/displaysink_used_correctly.rs @@ -0,0 +1,24 @@ +#![no_main] +#[macro_use] extern crate libfuzzer_sys; +extern crate yaxpeax_x86; +extern crate yaxpeax_arch; + +fuzz_target!(|data: &[u8]| { + let x86_64_decoder = yaxpeax_x86::long_mode::InstDecoder::default(); + let x86_32_decoder = yaxpeax_x86::protected_mode::InstDecoder::default(); + let x86_16_decoder = yaxpeax_x86::real_mode::InstDecoder::default(); + + use yaxpeax_arch::testkit::DisplaySinkValidator; + + if let Ok(inst) = x86_64_decoder.decode_slice(data) { + inst.display_into(&mut DisplaySinkValidator::new()).expect("instruction can be displayed"); + }; + + if let Ok(inst) = x86_32_decoder.decode_slice(data) { + inst.display_into(&mut DisplaySinkValidator::new()).expect("instruction can be displayed"); + }; + + if let Ok(inst) = x86_16_decoder.decode_slice(data) { + inst.display_into(&mut DisplaySinkValidator::new()).expect("instruction can be displayed"); + }; +}); diff --git a/fuzz/fuzz_targets/small_reg_is_always_old_bank_if_possible.rs b/fuzz/fuzz_targets/small_reg_is_always_old_bank_if_possible.rs index a143205..b00ecb4 100644 --- a/fuzz/fuzz_targets/small_reg_is_always_old_bank_if_possible.rs +++ b/fuzz/fuzz_targets/small_reg_is_always_old_bank_if_possible.rs @@ -12,8 +12,8 @@ extern crate yaxpeax_x86; // cases. leaving them in for fuzz targets to match other cases, and In Case Of Future Change. fuzz_target!(|data: &[u8]| { let x86_64_decoder = yaxpeax_x86::long_mode::InstDecoder::default(); - let x86_32_decoder = yaxpeax_x86::protected_mode::InstDecoder::default(); - let x86_16_decoder = yaxpeax_x86::real_mode::InstDecoder::default(); + // let x86_32_decoder = yaxpeax_x86::protected_mode::InstDecoder::default(); + // let x86_16_decoder = yaxpeax_x86::real_mode::InstDecoder::default(); if let Ok(inst) = x86_64_decoder.decode_slice(data) { for i in 0..inst.operand_count() { |