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

View File

@ -53,7 +53,7 @@ def ld_mode():
args += sys.argv[1:] args += sys.argv[1:]
args += [ args += [
os.path.join(script_dir, "runtime", "rt.o"), 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"] 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 { if corpus.count() < 1 {
println!("Generating random inputs");
state state
.generate_initial_inputs( .generate_initial_inputs(
&mut rand, &mut rand,

View File

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