test cmplog against value profile feature

This commit is contained in:
Omree 2021-05-09 10:14:59 +03:00
parent 2bbff1b7ab
commit 85a90c7d21
4 changed files with 18 additions and 5 deletions

View File

@ -12,14 +12,13 @@ members = [
"libafl_targets", "libafl_targets",
"libafl_frida", "libafl_frida",
"libafl_tests", "libafl_tests",
"fuzzers/frida_libpng",
] ]
default-members = [ default-members = [
"libafl", "libafl",
"libafl_derive", "libafl_derive",
"libafl_cc", "libafl_cc",
"libafl_targets", "libafl_targets",
"libafl_tests",
] ]
exclude = [ exclude = [
"fuzzers",
] ]

View File

@ -25,6 +25,7 @@ libafl = { path = "../../libafl/", features = [ "std", "llmp_bind_public" ] } #,
libafl_frida = { path = "../../libafl_frida" } libafl_frida = { path = "../../libafl_frida" }
capstone = "0.8.0" capstone = "0.8.0"
frida-gum = { version = "0.5.1", features = [ "auto-download", "backtrace", "event-sink", "invocation-listener"] } frida-gum = { version = "0.5.1", features = [ "auto-download", "backtrace", "event-sink", "invocation-listener"] }
libafl_targets = { path = "../../libafl_targets", version = "0.1.0" , features = ["value_profile"] }
lazy_static = "1.4.0" lazy_static = "1.4.0"
libc = "0.2" libc = "0.2"
libloading = "0.7.0" libloading = "0.7.0"

View File

@ -101,14 +101,27 @@ void func2() {
} }
__attribute__((noinline)) __attribute__((noinline))
void func1() { void func1() {
//printf("func1\n"); //printf("func1\n");
func2(); func2();
} }
// Entry point for LibFuzzer. // Entry point for LibFuzzer.
// Roughly follows the libpng book example: // Roughly follows the libpng book example:
// http://www.libpng.org/pub/png/book/chapter13.html // http://www.libpng.org/pub/png/book/chapter13.html
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if (size < kPngHeaderSize) {
if(data[10] == 0xAB &&
data[11] == 0xCD &&
data[12] == 0xEF &&
data[13] == 0xAA &&
data[14] == 0xBB ) {
printf("passed the test!");
} else {
printf("x");
return 0;
}
if (size < kPngHeaderSize) {
return 0; return 0;
} }

View File

@ -15,7 +15,7 @@ cc = { version = "1.0", features = ["parallel"] }
[dependencies] [dependencies]
libafl = { path = "../libafl", version = "0.3.1", features = ["std", "libafl_derive"] } libafl = { path = "../libafl", version = "0.3.1", features = ["std", "libafl_derive"] }
libafl_targets = { path = "../libafl_targets", version = "0.3.1" } libafl_targets = { path = "../libafl_targets", version = "0.3.1", features = ["cmplog"] }
nix = "0.20.0" nix = "0.20.0"
libc = "0.2.92" libc = "0.2.92"
hashbrown = "0.11" hashbrown = "0.11"