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 /fuzz/fuzz_targets/displaysink_used_correctly.rs | |
parent | 577b8e89849db33427e4be961997ad7af5e048f1 (diff) |
update yaxpeax-arch to 0.3.1, fix fuzz target warnings
Diffstat (limited to 'fuzz/fuzz_targets/displaysink_used_correctly.rs')
-rw-r--r-- | fuzz/fuzz_targets/displaysink_used_correctly.rs | 24 |
1 files changed, 24 insertions, 0 deletions
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"); + }; +}); |