diff options
author | Andrew Bartlett <abartlet@samba.org> | 2019-12-13 12:01:01 +1300 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2019-12-18 06:39:26 +0000 |
commit | 5a989d6670911e16aed9061a8c6a74676f4c8a8e (patch) | |
tree | 27bc80e321cede7cbc7f6c9442bdc9661f1086f6 /lib | |
parent | 66d12eb98aba10948f829d08b4144969ead5ddbb (diff) | |
download | samba-5a989d6670911e16aed9061a8c6a74676f4c8a8e.tar.gz |
lib/fuzzing: Allow load of fuzz inputs as files on the command line
This is easier to put under gdb.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fuzzing/afl-fuzz-main.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/fuzzing/afl-fuzz-main.c b/lib/fuzzing/afl-fuzz-main.c index 730aa39ae49..9f677557867 100644 --- a/lib/fuzzing/afl-fuzz-main.c +++ b/lib/fuzzing/afl-fuzz-main.c @@ -28,6 +28,20 @@ int main(int argc, char *argv[]) { size_t size = 0; #ifdef __AFL_LOOP while (__AFL_LOOP(1000)) +#else + int i; + for (i = 0; i < argc; i++) { + uint8_t *buf = (uint8_t *)file_load(argv[i], + &size, + 0, + NULL); + ret = LLVMFuzzerTestOneInput(buf, size); + TALLOC_FREE(buf); + if (ret != 0) { + return ret; + } + } + if (i == 0) #endif { uint8_t *buf = (uint8_t *)fd_load(0, &size, 0, NULL); |