Fmt, no_std fixes (#1167)

* Fmt, no_std fixes

* push-stage fix
This commit is contained in:
Dominik Maier 2023-03-23 00:10:01 +01:00 committed by GitHub
parent 02c6cab744
commit 76e4f6031d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 9 deletions

View File

@ -1,6 +1,6 @@
#[cfg(windows)]
use std::ptr::write_volatile;
use std::{fs, io::Read, path::PathBuf,ptr::write};
use std::{fs, io::Read, path::PathBuf, ptr::write};
use libafl::{
bolts::{current_nanos, rands::StdRand, tuples::tuple_list, AsSlice},
@ -24,10 +24,10 @@ use libafl::{
/// Coverage map with explicit assignments due to the lack of instrumentation
static mut SIGNALS: [u8; 16] = [0; 16];
static mut SIGNALS_PTR: *mut u8=unsafe{SIGNALS.as_mut_ptr()};
static mut SIGNALS_PTR: *mut u8 = unsafe { SIGNALS.as_mut_ptr() };
/// Assign a signal to the signals map
fn signals_set(idx: usize) {
unsafe{write(SIGNALS_PTR.add(idx),1)};
unsafe { write(SIGNALS_PTR.add(idx), 1) };
}
fn is_sub<T: PartialEq>(mut haystack: &[T], needle: &[T]) -> bool {
@ -82,7 +82,7 @@ pub fn main() {
};
// Create an observation channel using the signals map
let observer=unsafe{StdMapObserver::from_mut_ptr("signals",SIGNALS_PTR,SIGNALS.len())};
let observer = unsafe { StdMapObserver::from_mut_ptr("signals", SIGNALS_PTR, SIGNALS.len()) };
// Feedback to rate the interestingness of an input
let mut feedback = MaxMapFeedback::tracking(&observer, false, true);

View File

@ -67,7 +67,7 @@ pub fn main() {
let mgr = SimpleEventManager::new(monitor);
// A queue policy to get testcasess from the corpus
let scheduler = QueueScheduler::new();
let mut scheduler = QueueScheduler::new();
// Create the executor for an in-process function with just one observer
//let mut executor = InProcessExecutor::new(&mut harness, &mut fuzzer, &mut state, &mut mgr)

View File

@ -2,10 +2,10 @@
//! (As opposed to other, more abstract, inputs, like an Grammar-Based AST Input)
//! See also [the paper on token-level fuzzing](https://www.usenix.org/system/files/sec21-salls.pdf)
#[cfg(feature = "std")]
#[cfg(feature = "regex")]
use alloc::string::ToString;
use alloc::{borrow::ToOwned, rc::Rc, string::String, vec::Vec};
#[cfg(feature = "std")]
#[cfg(feature = "regex")]
use core::str::from_utf8;
use core::{
cell::RefCell,

View File

@ -24,7 +24,7 @@ Welcome to `LibAFL`
clippy::ptr_as_ptr,
clippy::missing_panics_doc,
clippy::missing_docs_in_private_items,
clippy::module_name_repetitions,
clippy::module_name_repetitions
)]
#![cfg_attr(not(test), warn(
missing_debug_implementations,

View File

@ -317,14 +317,15 @@ impl Default for NopMonitor {
}
}
#[cfg(feature = "std")]
/// Tracking monitor during fuzzing that just prints to `stdout`.
#[cfg(feature = "std")]
#[derive(Debug, Clone)]
pub struct SimplePrintingMonitor {
start_time: Duration,
client_stats: Vec<ClientStats>,
}
#[cfg(feature = "std")]
impl Default for SimplePrintingMonitor {
fn default() -> Self {
Self {