fixes for win32

This commit is contained in:
Andrea Fioraldi 2021-03-18 16:45:54 +01:00
parent 301f152d39
commit 38368c121b
2 changed files with 7 additions and 8 deletions

View File

@ -195,7 +195,7 @@ unsafe extern "system" fn handle_exception(exception_pointers: *mut EXCEPTION_PO
} }
None => EXCEPTION_CONTINUE_EXECUTION, None => EXCEPTION_CONTINUE_EXECUTION,
}; };
if let Some(prev_handler) = unsafe { PREVIOUS_HANDLER } { if let Some(prev_handler) = PREVIOUS_HANDLER {
prev_handler(exception_pointers) prev_handler(exception_pointers)
} else { } else {
ret ret
@ -215,12 +215,10 @@ pub unsafe fn setup_exception_handler<T: 'static + Handler>(handler: &mut T) ->
} }
compiler_fence(Ordering::SeqCst); compiler_fence(Ordering::SeqCst);
unsafe {
if let Some(prev) = SetUnhandledExceptionFilter(Some(core::mem::transmute( if let Some(prev) = SetUnhandledExceptionFilter(Some(core::mem::transmute(
handle_exception as *const c_void, handle_exception as *const c_void,
))) { ))) {
PREVIOUS_HANDLER = Some(core::mem::transmute(prev as *const c_void)); PREVIOUS_HANDLER = Some(core::mem::transmute(prev as *const c_void));
} }
}
Ok(()) Ok(())
} }

View File

@ -540,7 +540,8 @@ pub mod shmem {
pub fn new(map_size: usize) -> Result<Self, Error> { pub fn new(map_size: usize) -> Result<Self, Error> {
let uuid = Uuid::new_v4(); let uuid = Uuid::new_v4();
let mut map_str_bytes = format!("libafl_{}", uuid.to_simple()).as_mut_vec(); let mut map_str = format!("libafl_{}", uuid.to_simple());
let map_str_bytes = map_str.as_mut_vec();
map_str_bytes[19] = 0; // Trucate to size 20 map_str_bytes[19] = 0; // Trucate to size 20
unsafe { unsafe {
let handle = CreateFileMappingA( let handle = CreateFileMappingA(