From e3a33439715133cdabe70b7932bb093dc1e63b23 Mon Sep 17 00:00:00 2001 From: iximeow Date: Sat, 3 Jul 2021 17:19:08 -0700 Subject: fix yaxpeax_arch use in ffi packaging --- ffi/src/long_mode.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'ffi') diff --git a/ffi/src/long_mode.rs b/ffi/src/long_mode.rs index a3fd784..d0d3f22 100644 --- a/ffi/src/long_mode.rs +++ b/ffi/src/long_mode.rs @@ -1,10 +1,11 @@ -use yaxpeax_arch::{Arch, Decoder, LengthedInstruction, AddressBase}; +use yaxpeax_arch::{Arch, Decoder, LengthedInstruction, U8Reader, AddressBase}; use yaxpeax_x86::long_mode; #[no_mangle] -pub unsafe extern "C" fn yaxpeax_x86_64_decode_optimistic(data: *const u8, length: u64, inst: *mut long_mode::Instruction) -> bool { +pub unsafe extern "C" fn yaxpeax_x86_64_decode(data: *const u8, length: u64, inst: *mut long_mode::Instruction) -> bool { let inst: &mut long_mode::Instruction = core::mem::transmute(inst); - ::Decoder::default().decode_into(inst, core::slice::from_raw_parts(data as *const u8, length as usize).iter().cloned()).is_err() + let mut reader = U8Reader::new(core::slice::from_raw_parts(data as *const u8, length as usize)); + ::Decoder::default().decode_into(inst, &mut reader).is_err() } #[no_mangle] -- cgit v1.1