Files
xen/tools/fuzz/libelf/libelf-fuzzer.c
T
Wei Liu 4f62f31d25 tools/fuzz: introduce libelf target
Source code and Makefile to fuzz libelf in Google's oss-fuzz
infrastructure.

Introduce FUZZ_NO_LIBXC in libelf-private.h. That macro will be set when
compiling libelf fuzzer target because libxc is not required in libelf
fuzzing.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2016-12-13 10:25:57 +00:00

33 lines
557 B
C

#include <inttypes.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <xen/libelf/libelf.h>
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
struct elf_binary elf_buf, *elf;
struct elf_dom_parms parms;
elf = &elf_buf;
memset(elf, 0, sizeof(*elf));
elf_init(elf, (const char *)data, size);
elf_parse_binary(elf);
elf_xen_parse(elf, &parms);
return 0;
}
/*
* Local variables:
* mode: C
* c-file-style: "BSD"
* c-basic-offset: 4
* tab-width: 4
* indent-tabs-mode: nil
* End:
*/