1AUTOMAKE_OPTIONS = -Wno-syntax 2EXTRA_PROGRAMS = genSeed html regexp schema uri xml xpath 3check_PROGRAMS = testFuzzer 4EXTRA_DIST = html.dict regexp.dict schema.dict xml.dict xpath.dict \ 5 static_seed/uri static_seed/regexp fuzz.h 6CLEANFILES = $(EXTRA_PROGRAMS) 7AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include 8DEPENDENCIES = $(top_builddir)/libxml2.la 9LDADD = $(STATIC_BINARIES) $(top_builddir)/libxml2.la $(THREAD_LIBS) $(Z_LIBS) $(LZMA_LIBS) $(ICONV_LIBS) $(M_LIBS) $(WIN32_EXTRA_LIBADD) 10 11XML_MAX_LEN = 80000 12# Single quotes to avoid wildcard expansion by the shell 13XML_SEED_CORPUS_SRC = \ 14 '$(top_srcdir)/test/*' \ 15 '$(top_srcdir)/test/errors/*.xml' \ 16 '$(top_srcdir)/test/errors10/*.xml' \ 17 '$(top_srcdir)/test/namespaces/*' \ 18 '$(top_srcdir)/test/valid/*.xml' \ 19 '$(top_srcdir)/test/VC/*' \ 20 '$(top_srcdir)/test/VCM/*' \ 21 '$(top_srcdir)/test/XInclude/docs/*' \ 22 '$(top_srcdir)/test/xmlid/*' 23 24testFuzzer_SOURCES = testFuzzer.c fuzz.c 25 26.PHONY: tests corpus clean-corpus 27 28corpus: seed/html.stamp seed/regexp.stamp seed/schema.stamp seed/uri.stamp \ 29 seed/xml.stamp seed/xpath.stamp 30 31tests: testFuzzer$(EXEEXT) corpus 32 @echo "## Running fuzzer tests" 33 @./testFuzzer$(EXEEXT) 34 35clean-corpus: 36 rm -rf seed 37 38clean-local: clean-corpus 39 40# Seed corpus 41 42genSeed_SOURCES = genSeed.c fuzz.c 43 44# XML fuzzer 45 46seed/xml.stamp: genSeed$(EXEEXT) 47 @mkdir -p seed/xml 48 ./genSeed$(EXEEXT) xml $(XML_SEED_CORPUS_SRC) 49 @touch seed/xml.stamp 50 51xml_SOURCES = xml.c fuzz.c 52xml_LDFLAGS = -fsanitize=fuzzer 53 54fuzz-xml: xml$(EXEEXT) seed/xml.stamp 55 @mkdir -p corpus/xml 56 ./xml$(EXEEXT) \ 57 -dict=xml.dict \ 58 -max_len=$(XML_MAX_LEN) \ 59 -timeout=20 \ 60 corpus/xml seed/xml 61 62# HTML fuzzer 63 64seed/html.stamp: genSeed$(EXEEXT) 65 @mkdir -p seed/html 66 ./genSeed$(EXEEXT) html '$(top_srcdir)/test/HTML/*' 67 @touch seed/html.stamp 68 69html_SOURCES = html.c fuzz.c 70html_LDFLAGS = -fsanitize=fuzzer 71 72fuzz-html: html$(EXEEXT) seed/html.stamp 73 @mkdir -p corpus/html 74 ./html$(EXEEXT) \ 75 -dict=html.dict \ 76 -max_len=1000000 \ 77 -timeout=10 \ 78 corpus/html seed/html 79 80# Regexp fuzzer 81 82seed/regexp.stamp: 83 @mkdir -p seed/regexp 84 cp -r $(srcdir)/static_seed/regexp seed 85 @touch seed/regexp.stamp 86 87regexp_SOURCES = regexp.c fuzz.c 88regexp_LDFLAGS = -fsanitize=fuzzer 89 90fuzz-regexp: regexp$(EXEEXT) 91 @mkdir -p corpus/regexp 92 ./regexp$(EXEEXT) \ 93 -dict=regexp.dict \ 94 -max_len=200 \ 95 -timeout=5 \ 96 corpus/regexp seed/regexp 97 98# URI fuzzer 99 100seed/uri.stamp: 101 @mkdir -p seed/uri 102 cp -r $(srcdir)/static_seed/uri seed 103 @touch seed/uri.stamp 104 105uri_SOURCES = uri.c fuzz.c 106uri_LDFLAGS = -fsanitize=fuzzer 107 108fuzz-uri: uri$(EXEEXT) 109 @mkdir -p corpus/uri 110 ./uri$(EXEEXT) \ 111 -max_len=10000 \ 112 -timeout=2 \ 113 corpus/uri seed/uri 114 115# XML Schema fuzzer 116 117seed/schema.stamp: genSeed$(EXEEXT) 118 @mkdir -p seed/schema 119 ./genSeed$(EXEEXT) schema '$(top_srcdir)/test/schemas/*.xsd' 120 @touch seed/schema.stamp 121 122schema_SOURCES = schema.c fuzz.c 123schema_LDFLAGS = -fsanitize=fuzzer 124 125fuzz-schema: schema$(EXEEXT) seed/schema.stamp 126 @mkdir -p corpus/schema 127 ./schema$(EXEEXT) \ 128 -dict=schema.dict \ 129 -max_len=$(XML_MAX_LEN) \ 130 -timeout=20 \ 131 corpus/schema seed/schema 132 133# XPath fuzzer 134 135seed/xpath.stamp: genSeed$(EXEEXT) 136 @mkdir -p seed/xpath 137 ./genSeed$(EXEEXT) xpath '$(top_srcdir)/test/XPath' 138 @touch seed/xpath.stamp 139 140xpath_SOURCES = xpath.c fuzz.c 141xpath_LDFLAGS = -fsanitize=fuzzer 142 143fuzz-xpath: xpath$(EXEEXT) seed/xpath.stamp 144 @mkdir -p corpus/xpath 145 ./xpath$(EXEEXT) \ 146 -dict=xpath.dict \ 147 -max_len=10000 \ 148 -timeout=20 \ 149 corpus/xpath seed/xpath 150 151