ix UB in baby_fuzzer_grimoire (#1166)
This commit is contained in:
parent
38ea17b426
commit
7c514c3669
@ -1,6 +1,6 @@
|
|||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
use std::ptr::write_volatile;
|
use std::ptr::write_volatile;
|
||||||
use std::{fs, io::Read, path::PathBuf};
|
use std::{fs, io::Read, path::PathBuf,ptr::write};
|
||||||
|
|
||||||
use libafl::{
|
use libafl::{
|
||||||
bolts::{current_nanos, rands::StdRand, tuples::tuple_list, AsSlice},
|
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
|
/// Coverage map with explicit assignments due to the lack of instrumentation
|
||||||
static mut SIGNALS: [u8; 16] = [0; 16];
|
static mut SIGNALS: [u8; 16] = [0; 16];
|
||||||
|
static mut SIGNALS_PTR: *mut u8=unsafe{SIGNALS.as_mut_ptr()};
|
||||||
/// Assign a signal to the signals map
|
/// Assign a signal to the signals map
|
||||||
fn signals_set(idx: usize) {
|
fn signals_set(idx: usize) {
|
||||||
unsafe { SIGNALS[idx] = 1 };
|
unsafe{write(SIGNALS_PTR.add(idx),1)};
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_sub<T: PartialEq>(mut haystack: &[T], needle: &[T]) -> bool {
|
fn is_sub<T: PartialEq>(mut haystack: &[T], needle: &[T]) -> bool {
|
||||||
@ -82,8 +82,7 @@ pub fn main() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Create an observation channel using the signals map
|
// Create an observation channel using the signals map
|
||||||
let observer = unsafe { StdMapObserver::new("signals", &mut SIGNALS) };
|
let observer=unsafe{StdMapObserver::from_mut_ptr("signals",SIGNALS_PTR,SIGNALS.len())};
|
||||||
|
|
||||||
// Feedback to rate the interestingness of an input
|
// Feedback to rate the interestingness of an input
|
||||||
let mut feedback = MaxMapFeedback::tracking(&observer, false, true);
|
let mut feedback = MaxMapFeedback::tracking(&observer, false, true);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user