save ondisk
This commit is contained in:
parent
746d2a326e
commit
d16fd07beb
4
.gitignore
vendored
4
.gitignore
vendored
@ -10,9 +10,11 @@ Cargo.lock
|
||||
*.dll
|
||||
*.exe
|
||||
|
||||
crashes
|
||||
|
||||
callgrind.out.*
|
||||
perf.data
|
||||
perf.data.old
|
||||
|
||||
.vscode
|
||||
test.dict
|
||||
test.dict
|
||||
|
@ -59,6 +59,7 @@ where
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
entry.store_input().expect("Could not save testcase to disk".into());
|
||||
self.entries.push(RefCell::new(entry));
|
||||
self.entries.len() - 1
|
||||
}
|
||||
|
@ -41,6 +41,22 @@ where
|
||||
Ok(self.input.as_ref().unwrap())
|
||||
}
|
||||
|
||||
/// Store the input to disk if possible
|
||||
pub fn store_input(&mut self) -> Result<bool, AflError> {
|
||||
let fname;
|
||||
match self.filename() {
|
||||
Some(f) => { fname = f.clone(); },
|
||||
None => { return Ok(false); }
|
||||
};
|
||||
match self.input_mut() {
|
||||
None => Ok(false),
|
||||
Some(i) => {
|
||||
i.to_file(fname)?;
|
||||
Ok(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the input, if any
|
||||
#[inline]
|
||||
pub fn input(&self) -> &Option<I> {
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
mkdir -p ./crashes
|
||||
|
||||
cargo build --release || exit 1
|
||||
cp ../../target/release/libfuzzer ./.libfuzzer_test.elf
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user