[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] fuzz/libelf: return early if elf_init fails



commit 53693bf3beaf530699465a9209dab95e3db37378
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Wed Jan 25 11:14:42 2017 +0000
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Thu Jan 26 17:23:40 2017 +0000

    fuzz/libelf: return early if elf_init fails
    
    Coverity-ID: 1399557
    
    Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 tools/fuzz/libelf/libelf-fuzzer.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/fuzz/libelf/libelf-fuzzer.c 
b/tools/fuzz/libelf/libelf-fuzzer.c
index 71561d3..1ba8571 100644
--- a/tools/fuzz/libelf/libelf-fuzzer.c
+++ b/tools/fuzz/libelf/libelf-fuzzer.c
@@ -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);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.