fuzz: minor changes to libefl fuzzer
cover fuzz: minor changes to libefl fuzzer
Prompted by coverity scan.
Wei Liu (2):
fuzz/libelf: return early if elf_init fails fuzz/libelf: exit with fuzzer function return value
tools/fuzz/libelf/afl-libelf-fuzzer.c | 4 +--- tools/fuzz/libelf/libelf-fuzzer.c | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-)
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 1/2 fuzz/libelf: return early if elf_init fails
Coverity-ID: 1399557
Signed-off-by Wei Liu <[email protected]>
--- tools/fuzz/libelf/libelf-fuzzer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/fuzz/libelf/libelf-fuzzer.c +3 -1
@@ -13,7 +13,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) elf = &elf_buf;memset (elf,0 ,sizeof (*elf)); -elf_init (elf, (const char *)data, size); +if (elf_init (elf, (const char *)data, size) <0 ) +return -1 ; +elf_parse_binary (elf);elf_xen_parse (elf, &parms);
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 2/2 fuzz/libelf: exit with fuzzer function return value
In reply to Wei LiuNow the function can return nonzero value. Use that value as exit code for the stub program. AFL might be able to use such information to optimise fuzzing process.
Signed-off-by Wei Liu <[email protected]>
--- tools/fuzz/libelf/afl-libelf-fuzzer.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
tools/fuzz/libelf/afl-libelf-fuzzer.c +1 -3
@@ -42,9 +42,7 @@ int main(int argc, char **argv)fclose (fp); -LLVMFuzzerTestOneInput (input, size); - -return 0 ; +return LLVMFuzzerTestOneInput (input, size); }/*
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel