aboutsummaryrefslogtreecommitdiff
path: root/fuzz/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'fuzz/Makefile')
-rw-r--r--fuzz/Makefile14
1 files changed, 11 insertions, 3 deletions
diff --git a/fuzz/Makefile b/fuzz/Makefile
index 26bb10c..6f5dc90 100644
--- a/fuzz/Makefile
+++ b/fuzz/Makefile
@@ -1,6 +1,6 @@
-include ../../config.mk
-ALL = text-fuzzer buffer-fuzzer
+ALL = text-fuzzer text-libfuzzer buffer-fuzzer
CC = afl-gcc
CFLAGS += -I. -I../.. -DBUFFER_SIZE=4 -DBLOCK_SIZE=4
@@ -8,7 +8,11 @@ test: $(ALL)
text-fuzzer: text-fuzzer.c fuzzer.h ../../text.c ../../text-util.c ../../text-motions.c ../../text-objects.c ../../text-regex.c
@echo Compiling $@ binary
- ${CC} ${CFLAGS} ${CFLAGS_STD} ${CFLAGS_LIBC} ${CFLAGS_EXTRA} ${filter %.c, $^} ${LDFLAGS} -o $@
+ @${CC} ${CFLAGS} ${CFLAGS_STD} ${CFLAGS_LIBC} ${CFLAGS_EXTRA} ${filter %.c, $^} ${LDFLAGS} -o $@
+
+text-libfuzzer: text-fuzzer.c fuzzer.h ../../text.c ../../text-util.c ../../text-motions.c ../../text-objects.c ../../text-regex.c
+ @echo Compiling $@ binary
+ @${CC} ${CFLAGS} ${CFLAGS_STD} ${CFLAGS_LIBC} ${CFLAGS_EXTRA} -DLIBFUZZER ${filter %.c, $^} -fsanitize=fuzzer,address,undefined ${LDFLAGS} -o $@
buffer-fuzzer: buffer-fuzzer.c fuzzer.h ../../buffer.c
@echo Compiling $@ binary
@@ -22,6 +26,10 @@ afl-fuzz-text: text-fuzzer
@afl-fuzz -i - -x "dictionaries/$<.dict" -o "results/$<" -- "./$<" || \
afl-fuzz -i "inputs/$<" -x "dictionaries/$<.dict" -o "results/$<" -- "./$<"
+libfuzzer-text: text-libfuzzer
+ @mkdir -p "results/$<"
+ @./$< -close_fd_mask=1 -only_ascii=1 -print_final_stats=1 "-dict=dictionaries/$<.dict" "inputs/$<" "results/$<"
+
afl-fuzz-buffer: buffer-fuzzer
@mkdir -p "results/$<"
@afl-fuzz -i - -x "dictionaries/$<.dict" -o "results/$<" -- "./$<" || \
@@ -34,4 +42,4 @@ clean:
distclean: clean
@rm -rf results/
-.PHONY: clean distclean debug afl-fuzz-text afl-fuzz-buffer
+.PHONY: clean distclean debug afl-fuzz-text libfuzzer-text afl-fuzz-buffer