next step
This commit is contained in:
parent
6c3e60df20
commit
7de1e19f78
@ -2,8 +2,8 @@
|
||||
|
||||
use core::fmt::Debug;
|
||||
use core::marker::PhantomData;
|
||||
use std::fs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fs;
|
||||
|
||||
use crate::corpus::{Corpus, Testcase};
|
||||
use crate::events::EventManager;
|
||||
@ -212,7 +212,6 @@ where
|
||||
EM: EventManager<C, E, OT, FT, I, R>,
|
||||
{
|
||||
for entry in fs::read_dir(in_dir)? {
|
||||
|
||||
let entry = entry?;
|
||||
|
||||
let file = entry.path().display().to_string();
|
||||
@ -220,41 +219,32 @@ where
|
||||
let attributes = fs::metadata(file.clone());
|
||||
|
||||
if !attributes.is_ok() {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
let attr = attributes?;
|
||||
|
||||
if attr.is_file() {
|
||||
|
||||
println!("Load file {}", file);
|
||||
//let input = read_file(file);
|
||||
//let fitness = self.evaluate_input(&input, engine.executor_mut())?;
|
||||
//if !self.add_if_interesting(corpus, input, fitness)?.is_none() {
|
||||
// added += 1;
|
||||
//}
|
||||
|
||||
} else if attr.is_dir() {
|
||||
|
||||
let _x = load_from_directory(
|
||||
let _x = self.load_from_directory(
|
||||
&mut corpus,
|
||||
&mut generator,
|
||||
&mut engine,
|
||||
&mut manager,
|
||||
file,
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
}
|
||||
|
||||
|
||||
pub fn load_initial_inputs<G, C, E, ET, EM>(
|
||||
&mut self,
|
||||
corpus: &mut C,
|
||||
@ -272,15 +262,13 @@ where
|
||||
{
|
||||
let mut added = 0 as u32;
|
||||
for directory in in_dir {
|
||||
|
||||
let _x = load_from_directory(
|
||||
let _x = self.load_from_directory(
|
||||
&mut corpus,
|
||||
&mut generator,
|
||||
&mut engine,
|
||||
&mut manager,
|
||||
directory,
|
||||
);
|
||||
|
||||
}
|
||||
manager.log(
|
||||
0,
|
||||
|
@ -120,13 +120,18 @@ void __sanitizer_cov_trace_switch(uint64_t val, uint64_t *cases) {
|
||||
}
|
||||
|
||||
__attribute__((weak)) int LLVMFuzzerInitialize(int *argc, char ***argv);
|
||||
|
||||
void afl_libfuzzer_main();
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int afl_libfuzzer_init(int *argc, char ***argv) {
|
||||
|
||||
if (LLVMFuzzerInitialize)
|
||||
LLVMFuzzerInitialize(&argc, &argv);
|
||||
return LLVMFuzzerInitialize(&argc, &argv);
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
afl_libfuzzer_main();
|
||||
return 0;
|
||||
|
@ -29,7 +29,7 @@ extern "C" {
|
||||
fn LLVMFuzzerTestOneInput(data: *const u8, size: usize) -> i32;
|
||||
|
||||
/// int LLVMFuzzerInitialize(int argc, char **argv)
|
||||
fn LLVMFuzzerInitialize(argc: u32, argv: *const *const u8) -> i32;
|
||||
fn afl_libfuzzer_init(argc: u32, argv: *const *const u8) -> i32;
|
||||
|
||||
static __lafl_edges_map: *mut u8;
|
||||
static __lafl_cmp_map: *mut u8;
|
||||
@ -120,6 +120,16 @@ pub extern "C" fn afl_libfuzzer_main() {
|
||||
}
|
||||
println!("We're a client, let's fuzz :)");
|
||||
|
||||
// unsafe {
|
||||
|
||||
// if afl_libfuzzer_init(...) == -1 {
|
||||
|
||||
// println("Warning: LLVMFuzzerInitialize failed with -1")
|
||||
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
let edges_observer =
|
||||
StdMapObserver::new_from_ptr(&NAME_COV_MAP, unsafe { __lafl_edges_map }, unsafe {
|
||||
__lafl_max_edges_size as usize
|
||||
|
Loading…
x
Reference in New Issue
Block a user