mirror of
https://github.com/ringtailsoftware/uvm32.git
synced 2026-06-05 22:43:39 +00:00
Simple fuzzer
This commit is contained in:
parent
0736381925
commit
7313047fd1
2 changed files with 32 additions and 0 deletions
9
hosts/fuzz/Makefile
Normal file
9
hosts/fuzz/Makefile
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
TOPDIR=../..
|
||||||
|
all:
|
||||||
|
afl-clang-fast -g3 -fsanitize=address,undefined -Wall -DUVM32_MEMORY_SIZE=8388608 -I${TOPDIR}/uvm32 -I${TOPDIR}/common -o host-fuzz ${TOPDIR}/uvm32/uvm32.c fuzz.c
|
||||||
|
afl-fuzz -i${TOPDIR}/precompiled -oo ./host-fuzz
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf host-fuzz o host-fuzz.dSYM
|
||||||
|
|
||||||
|
|
||||||
23
hosts/fuzz/fuzz.c
Normal file
23
hosts/fuzz/fuzz.c
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include "uvm32.h"
|
||||||
|
#include "../common/uvm32_common_custom.h"
|
||||||
|
|
||||||
|
__AFL_FUZZ_INIT();
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
__AFL_INIT();
|
||||||
|
uvm32_state_t vmst;
|
||||||
|
uvm32_evt_t evt;
|
||||||
|
|
||||||
|
uvm32_init(&vmst);
|
||||||
|
unsigned char *rom = __AFL_FUZZ_TESTCASE_BUF;
|
||||||
|
while (__AFL_LOOP(10000)) {
|
||||||
|
uvm32_load(&vmst, rom, __AFL_FUZZ_TESTCASE_LEN);
|
||||||
|
uvm32_run(&vmst, &evt, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue