[fuzzing] Add build system

This commit is contained in:
Behdad Esfahbod 2015-11-05 23:08:50 -08:00
parent 9c9ad214af
commit 19300183a6
5 changed files with 50 additions and 3 deletions

View File

@ -440,6 +440,7 @@ src/hb-ucdn/Makefile
util/Makefile
test/Makefile
test/api/Makefile
test/fuzzing/Makefile
test/shaping/Makefile
docs/Makefile
docs/version.xml

View File

@ -1,6 +1,6 @@
# Process this file with automake to produce Makefile.in
SUBDIRS = api shaping
SUBDIRS = api shaping fuzzing
# Convenience targets:
lib:

44
test/fuzzing/Makefile.am Normal file
View File

@ -0,0 +1,44 @@
# Process this file with automake to produce Makefile.in
NULL =
EXTRA_DIST =
CLEANFILES =
DISTCLEANFILES =
MAINTAINERCLEANFILES =
# Convenience targets:
lib:
@$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib
EXTRA_DIST += \
README \
$(NULL)
noinst_PROGRAMS = \
hb-fuzzer \
$(NULL)
check_PROGRAMS = $(noinst_PROGRAMS)
AM_CPPFLAGS = \
-DHB_DISABLE_DEPRECATED \
-I$(top_srcdir)/src/ \
-I$(top_builddir)/src/ \
$(NULL)
LDADD = \
$(top_builddir)/src/libharfbuzz.la \
$(NULL)
hb_fuzzer_SOURCES = \
hb-fuzzer.cc \
$(NULL)
hb_fuzzer_LDADD = \
$(LDADD) \
$(NULL)
hb_fuzzer_CPPFLAGS = \
$(AM_CPPFLAGS) \
-DMAIN \
-DHB_MAX_NESTING_LEVEL=3 \
-DHB_SANITIZE_MAX_EDITS=3 \
$(NULL)
-include $(top_srcdir)/git.mk

View File

@ -5,6 +5,8 @@ harfbuzz/test/fuzzing/hb-fuzzer.cc with:
- With -fsanitize-coverage=edge[,8bit-counters,trace-cmp]
- With various defines that limit worst case exponential behavior:
* -DHB_MAX_NESTING_LEVEL=3
* -DHB_SANITIZE_MAX_EDITS=3
* See Makefile.am for full list of flags
- link against libFuzzer
To run the fuzzer one needs to first obtain a test corpus as a directory

View File

@ -1,6 +1,6 @@
#include <stddef.h>
#include "src/hb.h"
#include "src/hb-ot.h"
#include <hb.h>
#include <hb-ot.h>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
const char text[] = "ABCDEXYZ123@_%&)*$!";