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 seed/uri seed/regexp fuzz.h 6CLEANFILES = $(EXTRA_PROGRAMS) 7AM_CPPFLAGS = -I$(top_srcdir)/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/schema.stamp seed/xml.stamp seed/xpath.stamp 29 30tests: testFuzzer$(EXEEXT) corpus 31 @echo "## Running fuzzer tests" 32 @./testFuzzer$(EXEEXT) 33 34clean-corpus: 35 rm -rf seed/html.stamp seed/html 36 rm -rf seed/schema.stamp seed/schema 37 rm -rf seed/xml.stamp seed/xml 38 rm -rf seed/xpath.stamp seed/xpath 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 82regexp_SOURCES = regexp.c fuzz.c 83regexp_LDFLAGS = -fsanitize=fuzzer 84 85fuzz-regexp: regexp$(EXEEXT) 86 @mkdir -p corpus/regexp 87 ./regexp$(EXEEXT) \ 88 -dict=regexp.dict \ 89 -max_len=200 \ 90 -timeout=5 \ 91 corpus/regexp $(srcdir)/seed/regexp 92 93# URI fuzzer 94 95uri_SOURCES = uri.c fuzz.c 96uri_LDFLAGS = -fsanitize=fuzzer 97 98fuzz-uri: uri$(EXEEXT) 99 @mkdir -p corpus/uri 100 ./uri$(EXEEXT) \ 101 -max_len=10000 \ 102 -timeout=2 \ 103 corpus/uri $(srcdir)/seed/uri 104 105# XML Schema fuzzer 106 107seed/schema.stamp: genSeed$(EXEEXT) 108 @mkdir -p seed/schema 109 @./genSeed$(EXEEXT) schema '$(top_srcdir)/test/schemas/*.xsd' 110 @touch seed/schema.stamp 111 112schema_SOURCES = schema.c fuzz.c 113schema_LDFLAGS = -fsanitize=fuzzer 114 115fuzz-schema: schema$(EXEEXT) seed/schema.stamp 116 @mkdir -p corpus/schema 117 ./schema$(EXEEXT) \ 118 -dict=schema.dict \ 119 -max_len=$(XML_MAX_LEN) \ 120 -timeout=20 \ 121 corpus/schema seed/schema 122 123# XPath fuzzer 124 125seed/xpath.stamp: genSeed$(EXEEXT) 126 @mkdir -p seed/xpath 127 @./genSeed$(EXEEXT) xpath "$(top_builddir)/test/XPath" 128 @touch seed/xpath.stamp 129 130xpath_SOURCES = xpath.c fuzz.c 131xpath_LDFLAGS = -fsanitize=fuzzer 132 133fuzz-xpath: xpath$(EXEEXT) seed/xpath.stamp 134 @mkdir -p corpus/xpath 135 ./xpath$(EXEEXT) \ 136 -dict=xpath.dict \ 137 -max_len=10000 \ 138 -timeout=20 \ 139 corpus/xpath seed/xpath 140 141