1 | AUTOMAKE_OPTIONS = -Wno-syntax
|
---|
2 | EXTRA_PROGRAMS = genSeed html regexp schema uri xml xpath
|
---|
3 | check_PROGRAMS = testFuzzer
|
---|
4 | EXTRA_DIST = html.dict regexp.dict schema.dict xml.dict xpath.dict \
|
---|
5 | static_seed/uri static_seed/regexp fuzz.h
|
---|
6 | CLEANFILES = $(EXTRA_PROGRAMS)
|
---|
7 | AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
|
---|
8 | DEPENDENCIES = $(top_builddir)/libxml2.la
|
---|
9 | LDADD = $(STATIC_BINARIES) $(top_builddir)/libxml2.la $(THREAD_LIBS) $(Z_LIBS) $(LZMA_LIBS) $(ICONV_LIBS) $(M_LIBS) $(WIN32_EXTRA_LIBADD)
|
---|
10 |
|
---|
11 | XML_MAX_LEN = 80000
|
---|
12 | # Single quotes to avoid wildcard expansion by the shell
|
---|
13 | XML_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 |
|
---|
24 | testFuzzer_SOURCES = testFuzzer.c fuzz.c
|
---|
25 |
|
---|
26 | .PHONY: tests corpus clean-corpus
|
---|
27 |
|
---|
28 | corpus: seed/html.stamp seed/regexp.stamp seed/schema.stamp seed/uri.stamp \
|
---|
29 | seed/xml.stamp seed/xpath.stamp
|
---|
30 |
|
---|
31 | tests: testFuzzer$(EXEEXT) corpus
|
---|
32 | @echo "## Running fuzzer tests"
|
---|
33 | @./testFuzzer$(EXEEXT)
|
---|
34 |
|
---|
35 | clean-corpus:
|
---|
36 | rm -rf seed
|
---|
37 |
|
---|
38 | clean-local: clean-corpus
|
---|
39 |
|
---|
40 | # Seed corpus
|
---|
41 |
|
---|
42 | genSeed_SOURCES = genSeed.c fuzz.c
|
---|
43 |
|
---|
44 | # XML fuzzer
|
---|
45 |
|
---|
46 | seed/xml.stamp: genSeed$(EXEEXT)
|
---|
47 | @mkdir -p seed/xml
|
---|
48 | ./genSeed$(EXEEXT) xml $(XML_SEED_CORPUS_SRC)
|
---|
49 | @touch seed/xml.stamp
|
---|
50 |
|
---|
51 | xml_SOURCES = xml.c fuzz.c
|
---|
52 | xml_LDFLAGS = -fsanitize=fuzzer
|
---|
53 |
|
---|
54 | fuzz-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 |
|
---|
64 | seed/html.stamp: genSeed$(EXEEXT)
|
---|
65 | @mkdir -p seed/html
|
---|
66 | ./genSeed$(EXEEXT) html '$(top_srcdir)/test/HTML/*'
|
---|
67 | @touch seed/html.stamp
|
---|
68 |
|
---|
69 | html_SOURCES = html.c fuzz.c
|
---|
70 | html_LDFLAGS = -fsanitize=fuzzer
|
---|
71 |
|
---|
72 | fuzz-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 |
|
---|
82 | seed/regexp.stamp:
|
---|
83 | @mkdir -p seed/regexp
|
---|
84 | cp -r $(srcdir)/static_seed/regexp seed
|
---|
85 | @touch seed/regexp.stamp
|
---|
86 |
|
---|
87 | regexp_SOURCES = regexp.c fuzz.c
|
---|
88 | regexp_LDFLAGS = -fsanitize=fuzzer
|
---|
89 |
|
---|
90 | fuzz-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 |
|
---|
100 | seed/uri.stamp:
|
---|
101 | @mkdir -p seed/uri
|
---|
102 | cp -r $(srcdir)/static_seed/uri seed
|
---|
103 | @touch seed/uri.stamp
|
---|
104 |
|
---|
105 | uri_SOURCES = uri.c fuzz.c
|
---|
106 | uri_LDFLAGS = -fsanitize=fuzzer
|
---|
107 |
|
---|
108 | fuzz-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 |
|
---|
117 | seed/schema.stamp: genSeed$(EXEEXT)
|
---|
118 | @mkdir -p seed/schema
|
---|
119 | ./genSeed$(EXEEXT) schema '$(top_srcdir)/test/schemas/*.xsd'
|
---|
120 | @touch seed/schema.stamp
|
---|
121 |
|
---|
122 | schema_SOURCES = schema.c fuzz.c
|
---|
123 | schema_LDFLAGS = -fsanitize=fuzzer
|
---|
124 |
|
---|
125 | fuzz-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 |
|
---|
135 | seed/xpath.stamp: genSeed$(EXEEXT)
|
---|
136 | @mkdir -p seed/xpath
|
---|
137 | ./genSeed$(EXEEXT) xpath '$(top_srcdir)/test/XPath'
|
---|
138 | @touch seed/xpath.stamp
|
---|
139 |
|
---|
140 | xpath_SOURCES = xpath.c fuzz.c
|
---|
141 | xpath_LDFLAGS = -fsanitize=fuzzer
|
---|
142 |
|
---|
143 | fuzz-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 |
|
---|