Enable building a bounded version of the library for fuzzing

test/fuzzing/hb-fuzzer links against libharfbuzz-fuzzing.so now.
This commit is contained in:
Behdad Esfahbod 2015-11-18 16:27:32 -08:00
parent e0082ae60d
commit ff16ef3379
3 changed files with 20 additions and 11 deletions

View File

@ -15,6 +15,7 @@ DISTCHECK_CONFIGURE_FLAGS = --enable-introspection
# Convenience targets:
lib: $(BUILT_SOURCES) libharfbuzz.la
fuzzing: $(BUILT_SOURCES) libharfbuzz-fuzzing.la
lib_LTLIBRARIES = libharfbuzz.la
@ -219,6 +220,21 @@ pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = harfbuzz.pc
EXTRA_DIST += harfbuzz.pc.in
FUZZING_CPPFLAGS= \
-DHB_MAX_NESTING_LEVEL=3 \
-DHB_SANITIZE_MAX_EDITS=3 \
-DHB_BUFFER_MAX_EXPANSION_FACTOR=3 \
-DHB_BUFFER_MAX_LEN_MIN=8 \
-DHB_BUFFER_MAX_LEN_DEFAULT=128 \
$(NULL)
EXTRA_LTLIBRARIES = libharfbuzz-fuzzing.la
libharfbuzz_fuzzing_la_LINK = $(libharfbuzz_la_LINK)
libharfbuzz_fuzzing_la_SOURCES = $(libharfbuzz_la_SOURCES)
libharfbuzz_fuzzing_la_CPPFLAGS = $(libharfbuzz_la_CPPFLAGS) $(FUZZING_CPPFLAGS)
libharfbuzz_fuzzing_la_LDFLAGS = $(libharfbuzz_la_LDFLAGS)
libharfbuzz_fuzzing_la_LIBADD = $(libharfbuzz_la_LIBADD)
EXTRA_libharfbuzz_fuzzing_la_DEPENDENCIES = $(EXTRA_libharfbuzz_la_DEPENDENCIES)
if HAVE_ICU
lib_LTLIBRARIES += libharfbuzz-icu.la
libharfbuzz_icu_la_SOURCES = hb-icu.cc

View File

@ -8,7 +8,7 @@ MAINTAINERCLEANFILES =
# Convenience targets:
lib:
@$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib
@$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src fuzzing
EXTRA_DIST += \
README \
@ -25,7 +25,7 @@ AM_CPPFLAGS = \
-I$(top_builddir)/src/ \
$(NULL)
LDADD = \
$(top_builddir)/src/libharfbuzz.la \
$(top_builddir)/src/libharfbuzz-fuzzing.la \
$(NULL)
hb_fuzzer_SOURCES = \
@ -37,11 +37,6 @@ hb_fuzzer_LDADD = \
hb_fuzzer_CPPFLAGS = \
$(AM_CPPFLAGS) \
-DMAIN \
-DHB_MAX_NESTING_LEVEL=3 \
-DHB_SANITIZE_MAX_EDITS=3 \
-DHB_BUFFER_MAX_EXPANSION_FACTOR=3 \
-DHB_BUFFER_MAX_LEN_MIN=8 \
-DHB_BUFFER_MAX_LEN_DEFAULT=128 \
$(NULL)
-include $(top_srcdir)/git.mk

View File

@ -3,10 +3,8 @@ harfbuzz/test/fuzzing/hb-fuzzer.cc with:
- Using the most recent Clang
- With -fsanitize=address (or =undefined, or a combination)
- 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
- With various defines that limit worst case exponential behavior.
See FUZZING_CPPFLAGS in harfbuzz/src/Makefile.am for the list.
- link against libFuzzer
To run the fuzzer one needs to first obtain a test corpus as a directory