From efe3d31cc22b38aac0cf8ae9156f401db2876341 Mon Sep 17 00:00:00 2001 From: Andrea Fioraldi Date: Thu, 18 Mar 2021 17:43:29 +0100 Subject: [PATCH] format --- libafl/src/bolts/os/windows_exceptions.rs | 5 +--- libafl/src/bolts/shmem.rs | 2 +- libafl/src/executors/inprocess.rs | 29 ++++++++++++----------- libafl/src/executors/mod.rs | 7 +++++- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/libafl/src/bolts/os/windows_exceptions.rs b/libafl/src/bolts/os/windows_exceptions.rs index 88a833d357..581dd98afb 100644 --- a/libafl/src/bolts/os/windows_exceptions.rs +++ b/libafl/src/bolts/os/windows_exceptions.rs @@ -1,9 +1,6 @@ pub use crate::bolts::bindings::windows::win32::debug::EXCEPTION_POINTERS; -use crate::{ - bolts::bindings::windows::win32::debug::{SetUnhandledExceptionFilter}, - Error, -}; +use crate::{bolts::bindings::windows::win32::debug::SetUnhandledExceptionFilter, Error}; use alloc::vec::Vec; use core::{ diff --git a/libafl/src/bolts/shmem.rs b/libafl/src/bolts/shmem.rs index c108a2aea4..a4d55d0100 100644 --- a/libafl/src/bolts/shmem.rs +++ b/libafl/src/bolts/shmem.rs @@ -455,7 +455,7 @@ pub mod shmem { Error, }; - use core::{ptr, slice, ffi::c_void}; + use core::{ffi::c_void, ptr, slice}; use uuid::Uuid; const INVALID_HANDLE_VALUE: isize = -1; diff --git a/libafl/src/executors/inprocess.rs b/libafl/src/executors/inprocess.rs index bac42e6566..7606284edf 100644 --- a/libafl/src/executors/inprocess.rs +++ b/libafl/src/executors/inprocess.rs @@ -2,10 +2,10 @@ //! It should usually be paired with extra error-handling, such as a restarting event manager, to be effective. use core::{ + ffi::c_void, + marker::PhantomData, ptr::{self, write_volatile}, sync::atomic::{compiler_fence, Ordering}, - ffi::c_void, - marker::PhantomData }; #[cfg(unix)] @@ -124,7 +124,6 @@ where } Ok(()) } - } impl Named for InProcessExecutor @@ -466,16 +465,16 @@ mod unix_signal_handler { #[cfg(windows)] mod windows_exception_handler { use alloc::vec::Vec; - use core::{ptr, ffi::c_void}; + use core::{ffi::c_void, ptr}; #[cfg(feature = "std")] - use std::{ - io::{stdout, Write}, - }; + use std::io::{stdout, Write}; use crate::{ bolts::{ - os::windows_exceptions::{Handler, ExceptionCode, EXCEPTION_POINTERS, CRASH_EXCEPTIONS}, - bindings::windows::win32::system_services::ExitProcess + bindings::windows::win32::system_services::ExitProcess, + os::windows_exceptions::{ + ExceptionCode, Handler, CRASH_EXCEPTIONS, EXCEPTION_POINTERS, + }, }, corpus::{Corpus, Testcase}, events::{Event, EventManager}, @@ -517,7 +516,7 @@ mod windows_exception_handler { unsafe fn nop_handler( _code: ExceptionCode, _exception_pointers: *mut EXCEPTION_POINTERS, - _data: &mut InProcessExecutorHandlerData + _data: &mut InProcessExecutorHandlerData, ) { } @@ -596,10 +595,12 @@ mod windows_exception_handler { { println!("Double crash\n"); let crash_addr = exception_pointers - .as_mut() - .unwrap() - .exception_record.as_mut() - .unwrap().exception_address as usize; + .as_mut() + .unwrap() + .exception_record + .as_mut() + .unwrap() + .exception_address as usize; println!( "We crashed at addr 0x{:x}, but are not in the target... Bug in the fuzzer? Exiting.", diff --git a/libafl/src/executors/mod.rs b/libafl/src/executors/mod.rs index bf4f5ee47b..a5ee692469 100644 --- a/libafl/src/executors/mod.rs +++ b/libafl/src/executors/mod.rs @@ -96,7 +96,12 @@ where /// Called right after execution finished. #[inline] - fn post_exec(&mut self, _state: &mut S, _event_mgr: &mut EM, _input: &I) -> Result<(), Error> + fn post_exec( + &mut self, + _state: &mut S, + _event_mgr: &mut EM, + _input: &I, + ) -> Result<(), Error> where EM: EventManager, {