diff options
author | iximeow <me@iximeow.net> | 2024-06-23 15:28:50 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2024-06-23 15:28:50 -0700 |
commit | 9d9bb9b8fbc5a04f40b927093cd3ba8e562f941d (patch) | |
tree | 525a7298e11d19380240d8278f15b7fc006de9f3 /fuzz/fuzz_targets | |
parent | 4225510d22ba087b6ba74f6ca8284263e63d29a1 (diff) |
InstructionTextBuffer for all three modes, adjust fuzzer to match
Diffstat (limited to 'fuzz/fuzz_targets')
-rw-r--r-- | fuzz/fuzz_targets/display_does_not_panic.rs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/fuzz/fuzz_targets/display_does_not_panic.rs b/fuzz/fuzz_targets/display_does_not_panic.rs index 97a14b8..39f5753 100644 --- a/fuzz/fuzz_targets/display_does_not_panic.rs +++ b/fuzz/fuzz_targets/display_does_not_panic.rs @@ -8,14 +8,26 @@ fuzz_target!(|data: &[u8]| { let x86_16_decoder = yaxpeax_x86::real_mode::InstDecoder::default(); if let Ok(inst) = x86_64_decoder.decode_slice(data) { - inst.write_to(&mut String::new()).expect("format does not panic"); + let mut out = String::new(); + inst.write_to(&mut out).expect("format does not panic"); + let mut text_buf = yaxpeax_x86::long_mode::InstructionTextBuffer::new(); + text_buf.format_inst(&inst.display_with(yaxpeax_x86::long_mode::DisplayStyle::Intel)).expect("can format"); + assert_eq!(text_buf.text_str(), out); }; if let Ok(inst) = x86_32_decoder.decode_slice(data) { - inst.write_to(&mut String::new()).expect("format does not panic"); + let mut out = String::new(); + inst.write_to(&mut out).expect("format does not panic"); + let mut text_buf = yaxpeax_x86::protected_mode::InstructionTextBuffer::new(); + text_buf.format_inst(&inst.display_with(yaxpeax_x86::protected_mode::DisplayStyle::Intel)).expect("can format"); + assert_eq!(text_buf.text_str(), out); }; if let Ok(inst) = x86_16_decoder.decode_slice(data) { - inst.write_to(&mut String::new()).expect("format does not panic"); + let mut out = String::new(); + inst.write_to(&mut out).expect("format does not panic"); + let mut text_buf = yaxpeax_x86::real_mode::InstructionTextBuffer::new(); + text_buf.format_inst(&inst.display_with(yaxpeax_x86::real_mode::DisplayStyle::Intel)).expect("can format"); + assert_eq!(text_buf.text_str(), out); }; }); |