clippy
This commit is contained in:
parent
c7f1d83b6e
commit
a3b22acb04
@ -1232,10 +1232,9 @@ where
|
|||||||
.expect("An error occurred when brokering. Exiting.");
|
.expect("An error occurred when brokering. Exiting.");
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
match sleep_time {
|
if let Some(time) = sleep_time {
|
||||||
Some(time) => thread::sleep(time),
|
thread::sleep(time)
|
||||||
None => (),
|
};
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(feature = "std"))]
|
#[cfg(not(feature = "std"))]
|
||||||
match sleep_time {
|
match sleep_time {
|
||||||
@ -1407,10 +1406,9 @@ where
|
|||||||
|
|
||||||
let map = &mut self.llmp_clients[client_id as usize].current_recv_map;
|
let map = &mut self.llmp_clients[client_id as usize].current_recv_map;
|
||||||
let msg_buf = (*msg).as_slice(map)?;
|
let msg_buf = (*msg).as_slice(map)?;
|
||||||
match (on_new_msg)(client_id, (*msg).tag, msg_buf)? {
|
if let LlmpMsgHookResult::Handled = (on_new_msg)(client_id, (*msg).tag, msg_buf)? {
|
||||||
LlmpMsgHookResult::Handled => should_forward_msg = false,
|
should_forward_msg = false
|
||||||
_ => (),
|
};
|
||||||
}
|
|
||||||
if should_forward_msg {
|
if should_forward_msg {
|
||||||
self.forward_msg(msg)?;
|
self.forward_msg(msg)?;
|
||||||
}
|
}
|
||||||
@ -1574,6 +1572,8 @@ where
|
|||||||
|
|
||||||
/// The current page could have changed in recv (EOP)
|
/// The current page could have changed in recv (EOP)
|
||||||
/// Alloc the next message, internally handling end of page by allocating a new one.
|
/// Alloc the next message, internally handling end of page by allocating a new one.
|
||||||
|
/// # Safety
|
||||||
|
/// Should be safe, but returns an unsafe ptr
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn alloc_next(&mut self, buf_len: usize) -> Result<*mut LlmpMsg, Error> {
|
pub unsafe fn alloc_next(&mut self, buf_len: usize) -> Result<*mut LlmpMsg, Error> {
|
||||||
self.sender.alloc_next(buf_len)
|
self.sender.alloc_next(buf_len)
|
||||||
|
@ -35,7 +35,7 @@ where
|
|||||||
/// Add an entry to the corpus and return its index
|
/// Add an entry to the corpus and return its index
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(&mut self, mut testcase: Testcase<I>) -> Result<usize, Error> {
|
fn add(&mut self, mut testcase: Testcase<I>) -> Result<usize, Error> {
|
||||||
if let None = testcase.filename() {
|
if testcase.filename().is_none() {
|
||||||
// TODO walk entry metadata to ask for pices of filename (e.g. :havoc in AFL)
|
// TODO walk entry metadata to ask for pices of filename (e.g. :havoc in AFL)
|
||||||
let filename = self.dir_path.join(format!("id_{}", &self.entries.len()));
|
let filename = self.dir_path.join(format!("id_{}", &self.entries.len()));
|
||||||
let filename_str = filename.to_str().expect("Invalid Path");
|
let filename_str = filename.to_str().expect("Invalid Path");
|
||||||
|
@ -328,18 +328,15 @@ where
|
|||||||
// TODO: Get around local event copy by moving handle_in_client
|
// TODO: Get around local event copy by moving handle_in_client
|
||||||
let mut events = vec![];
|
let mut events = vec![];
|
||||||
match &mut self.llmp {
|
match &mut self.llmp {
|
||||||
llmp::LlmpConnection::IsClient { client } => loop {
|
llmp::LlmpConnection::IsClient { client } => {
|
||||||
match client.recv_buf()? {
|
while let Some((sender_id, tag, msg)) = client.recv_buf()? {
|
||||||
Some((sender_id, tag, msg)) => {
|
|
||||||
if tag == _LLMP_TAG_EVENT_TO_BROKER {
|
if tag == _LLMP_TAG_EVENT_TO_BROKER {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let event: Event<I> = postcard::from_bytes(msg)?;
|
let event: Event<I> = postcard::from_bytes(msg)?;
|
||||||
events.push((sender_id, event));
|
events.push((sender_id, event));
|
||||||
}
|
}
|
||||||
None => break,
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
_ => {
|
_ => {
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
dbg!("Skipping process in broker");
|
dbg!("Skipping process in broker");
|
||||||
|
@ -46,7 +46,7 @@ pub fn buffer_self_copy(data: &mut [u8], from: usize, to: usize, len: usize) {
|
|||||||
debug_assert!(to + len <= data.len());
|
debug_assert!(to + len <= data.len());
|
||||||
if len != 0 && from != to {
|
if len != 0 && from != to {
|
||||||
let ptr = data.as_mut_ptr();
|
let ptr = data.as_mut_ptr();
|
||||||
unsafe { core::ptr::copy(ptr.offset(from as isize), ptr.offset(to as isize), len) }
|
unsafe { core::ptr::copy(ptr.add(from), ptr.add(to), len) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,13 +60,7 @@ pub fn buffer_copy(dst: &mut [u8], src: &[u8], from: usize, to: usize, len: usiz
|
|||||||
let dst_ptr = dst.as_mut_ptr();
|
let dst_ptr = dst.as_mut_ptr();
|
||||||
let src_ptr = src.as_ptr();
|
let src_ptr = src.as_ptr();
|
||||||
if len != 0 {
|
if len != 0 {
|
||||||
unsafe {
|
unsafe { core::ptr::copy(src_ptr.add(from), dst_ptr.add(to), len) }
|
||||||
core::ptr::copy(
|
|
||||||
src_ptr.offset(from as isize),
|
|
||||||
dst_ptr.offset(to as isize),
|
|
||||||
len,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,6 +139,17 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<I, R, S> Default for StdScheduledMutator<I, R, S>
|
||||||
|
where
|
||||||
|
I: Input,
|
||||||
|
S: HasRand<R>,
|
||||||
|
R: Rand,
|
||||||
|
{
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Schedule some selected byte level mutations given a ScheduledMutator type
|
/// Schedule some selected byte level mutations given a ScheduledMutator type
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct HavocBytesMutator<C, I, R, S, SM>
|
pub struct HavocBytesMutator<C, I, R, S, SM>
|
||||||
|
@ -75,7 +75,7 @@ impl Tokens {
|
|||||||
let line = line.trim_start().trim_end();
|
let line = line.trim_start().trim_end();
|
||||||
|
|
||||||
// we are only interested in '"..."', not prefixed 'foo = '
|
// we are only interested in '"..."', not prefixed 'foo = '
|
||||||
let start = line.chars().nth(0);
|
let start = line.chars().next();
|
||||||
if line.is_empty() || start == Some('#') {
|
if line.is_empty() || start == Some('#') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user