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

[Xen-devel] [PATCH 1/2] 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 71561d3460..1ba8571711 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);
 
-- 
2.11.0


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

 


Rackspace

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