-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Add AFL++ fuzzing support (#351)
- Loading branch information
1 parent
d7e8e29
commit 9449f03
Showing
4 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[package] | ||
name = "goblin-fuzz-afl" | ||
version = "0.0.1" | ||
authors = ["Andrey Fedotov <fedotoff@ispras.ru>"] | ||
edition = "2018" | ||
publish = false | ||
|
||
[dependencies.goblin] | ||
path = ".." | ||
|
||
[dependencies] | ||
afl = "*" | ||
|
||
# Prevent this from interfering with workspaces | ||
[workspace] | ||
members = ["."] | ||
|
||
[profile.release] | ||
debug = true | ||
|
||
[[bin]] | ||
name = "afl_parse" | ||
path = "fuzz_targets/afl_parse.rs" | ||
|
||
[[bin]] | ||
name = "afl_parse_elf" | ||
path = "fuzz_targets/afl_parse_elf.rs" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#[macro_use] | ||
extern crate afl; | ||
|
||
fn main() { | ||
fuzz!(|data: &[u8]| { | ||
let _ = goblin::Object::parse(data); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#[macro_use] | ||
extern crate afl; | ||
|
||
fn main() { | ||
fuzz!(|data: &[u8]| { | ||
if let Ok(elf) = goblin::elf::Elf::parse(data) { | ||
for section_header in &elf.section_headers { | ||
let _ = elf.shdr_strtab.get_at(section_header.sh_name); | ||
} | ||
|
||
for _relocation in &elf.dynrels {} | ||
|
||
if let Some(mut it) = elf.iter_note_headers(data) { | ||
while let Some(Ok(_a)) = it.next() {} | ||
} | ||
|
||
if let Some(mut it) = elf.iter_note_sections(data, None) { | ||
while let Some(Ok(_a)) = it.next() {} | ||
} | ||
|
||
if let Some(mut it) = elf.iter_note_sections(data, Some("x")) { | ||
while let Some(Ok(_a)) = it.next() {} | ||
} | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters