final touches

This commit is contained in:
van Hauser 2020-12-20 16:31:23 +01:00
parent 264cfff631
commit 91200f4bde
4 changed files with 6 additions and 7 deletions

View File

@ -70,9 +70,7 @@ where
{
for entry in fs::read_dir(in_dir)? {
let entry = entry?;
let path = entry.path();
let attributes = fs::metadata(&path);
if !attributes.is_ok() {
@ -81,13 +79,13 @@ where
let attr = attributes?;
if attr.is_file() {
if attr.is_file() && attr.len() > 0 {
println!("Load file {:?}", &path);
let bytes = std::fs::read(path)?;
let bytes = std::fs::read(&path)?;
let input = BytesInput::new(bytes);
let fitness = self.evaluate_input(&input, engine.executor_mut())?;
if self.add_if_interesting(corpus, input, fitness)?.is_none() {
println!("File {:?} was interesting, skipped.", &path);
println!("File {:?} was not interesting, skipped.", &path);
}
} else if attr.is_dir() {
self.load_from_directory(corpus, generator, engine, manager, &path)?;

View File

@ -53,7 +53,7 @@ def ld_mode():
args += sys.argv[1:]
args += [
os.path.join(script_dir, "runtime", "rt.o"),
os.path.join(script_dir, "target", "debug", "liblibfuzzer.a"),
os.path.join(script_dir, "target", "release", "liblibfuzzer.a"),
]
args += ["-fsanitize-coverage=trace-pc-guard,trace-cmp"]

View File

@ -164,6 +164,7 @@ pub extern "C" fn afl_libfuzzer_main() {
}
if corpus.count() < 1 {
println!("Generating random inputs");
state
.generate_initial_inputs(
&mut rand,

View File

@ -1,6 +1,6 @@
#!/bin/sh
cargo build || exit 1
cargo build --release || exit 1
make -C runtime || exit 1
rm -f test_fuzz.elf test_fuzz.o