Debian Codegraph @

fuzz/Makefile.am

raw
1 AUTOMAKE_OPTIONS = -Wno-syntax
2 EXTRA_PROGRAMS = genSeed \
3 api html lint reader regexp schema uri valid xinclude \
4 xml xpath
5 check_PROGRAMS = testFuzzer
6 EXTRA_DIST = html.dict regexp.dict schema.dict xml.dict xpath.dict \
7 static_seed/uri static_seed/regexp fuzz.h
8 CLEANFILES = $(EXTRA_PROGRAMS)
9 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
10 DEPENDENCIES = $(top_builddir)/libxml2.la
11 LDADD = $(top_builddir)/libxml2.la
12
13 XML_MAX_LEN = 80000
14 # Single quotes to avoid wildcard expansion by the shell
15 XML_SEED_CORPUS_SRC = \
16 '$(top_srcdir)/test/*' \
17 '$(top_srcdir)/test/errors/*.xml' \
18 '$(top_srcdir)/test/errors10/*.xml' \
19 '$(top_srcdir)/test/namespaces/*' \
20 '$(top_srcdir)/test/recurse/*.xml' \
21 '$(top_srcdir)/test/SVG/*.xml' \
22 '$(top_srcdir)/test/valid/*.xml' \
23 '$(top_srcdir)/test/VC/*' \
24 '$(top_srcdir)/test/VCM/*' \
25 '$(top_srcdir)/test/XInclude/docs/*' \
26 '$(top_srcdir)/test/XInclude/without-reader/*' \
27 '$(top_srcdir)/test/xmlid/*'
28
29 testFuzzer_SOURCES = testFuzzer.c fuzz.c
30
31 .PHONY: corpus clean-corpus
32
33 corpus: seed/html.stamp seed/lint.stamp seed/reader.stamp seed/regexp.stamp \
34 seed/schema.stamp seed/uri.stamp seed/valid.stamp seed/xinclude.stamp \
35 seed/xml.stamp seed/xpath.stamp
36
37 check-local: corpus
38 ./testFuzzer$(EXEEXT)
39
40 clean-corpus:
41 rm -rf seed
42
43 clean-local: clean-corpus
44
45 # Seed corpus
46
47 genSeed_SOURCES = genSeed.c fuzz.c
48
49 # XML fuzzer
50
51 seed/xml.stamp: genSeed$(EXEEXT)
52 @mkdir -p seed/xml
53 ./genSeed$(EXEEXT) xml $(XML_SEED_CORPUS_SRC)
54 @touch seed/xml.stamp
55
56 xml_SOURCES = xml.c fuzz.c
57 xml_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
58
59 fuzz-xml: xml$(EXEEXT) seed/xml.stamp
60 @mkdir -p corpus/xml
61 ./xml$(EXEEXT) \
62 -dict=$(srcdir)/xml.dict \
63 -max_len=$(XML_MAX_LEN) \
64 $$XML_FUZZ_OPTIONS \
65 corpus/xml seed/xml
66
67 # DTD validation fuzzer
68
69 seed/valid.stamp: genSeed$(EXEEXT)
70 @mkdir -p seed/valid
71 ./genSeed$(EXEEXT) valid $(XML_SEED_CORPUS_SRC)
72 @touch seed/valid.stamp
73
74 valid_SOURCES = valid.c fuzz.c
75 valid_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
76
77 fuzz-valid: valid$(EXEEXT) seed/valid.stamp
78 @mkdir -p corpus/valid
79 ./valid$(EXEEXT) \
80 -dict=$(srcdir)/xml.dict \
81 -max_len=$(XML_MAX_LEN) \
82 $$XML_FUZZ_OPTIONS \
83 corpus/valid seed/valid
84
85 # XInclude fuzzer
86
87 seed/xinclude.stamp: genSeed$(EXEEXT)
88 @mkdir -p seed/xinclude
89 ./genSeed$(EXEEXT) xinclude $(XML_SEED_CORPUS_SRC)
90 @touch seed/xinclude.stamp
91
92 xinclude_SOURCES = xinclude.c fuzz.c
93 xinclude_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
94
95 fuzz-xinclude: xinclude$(EXEEXT) seed/xinclude.stamp
96 @mkdir -p corpus/xinclude
97 ./xinclude$(EXEEXT) \
98 -dict=$(srcdir)/xml.dict \
99 -max_len=$(XML_MAX_LEN) \
100 $$XML_FUZZ_OPTIONS \
101 corpus/xinclude seed/xinclude
102
103 # HTML fuzzer
104
105 seed/html.stamp: genSeed$(EXEEXT)
106 @mkdir -p seed/html
107 ./genSeed$(EXEEXT) html '$(top_srcdir)/test/HTML/*'
108 @touch seed/html.stamp
109
110 html_SOURCES = html.c fuzz.c
111 html_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
112
113 fuzz-html: html$(EXEEXT) seed/html.stamp
114 @mkdir -p corpus/html
115 ./html$(EXEEXT) \
116 -dict=$(srcdir)/html.dict \
117 -max_len=1000000 \
118 $$XML_FUZZ_OPTIONS \
119 corpus/html seed/html
120
121 # Reader fuzzer
122
123 seed/reader.stamp: genSeed$(EXEEXT)
124 @mkdir -p seed/reader
125 ./genSeed$(EXEEXT) reader $(XML_SEED_CORPUS_SRC)
126 @touch seed/reader.stamp
127
128 reader_SOURCES = reader.c fuzz.c
129 reader_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
130
131 fuzz-reader: reader$(EXEEXT) seed/reader.stamp
132 @mkdir -p corpus/reader
133 ./reader$(EXEEXT) \
134 -dict=$(srcdir)/xml.dict \
135 -max_len=$(XML_MAX_LEN) \
136 $$XML_FUZZ_OPTIONS \
137 corpus/reader seed/reader
138
139 # xmllint fuzzer
140
141 seed/lint.stamp: genSeed$(EXEEXT)
142 @mkdir -p seed/lint
143 ./genSeed$(EXEEXT) lint $(XML_SEED_CORPUS_SRC)
144 @touch seed/lint.stamp
145
146 lint_SOURCES = lint.c fuzz.c ../xmllint.c ../shell.c
147 lint_LDFLAGS = -fsanitize=fuzzer
148
149 fuzz-lint: lint$(EXEEXT) seed/lint.stamp
150 @mkdir -p corpus/lint
151 ./lint$(EXEEXT) \
152 -dict=$(srcdir)/xml.dict \
153 -max_len=$(XML_MAX_LEN) \
154 $$XML_FUZZ_OPTIONS \
155 corpus/lint seed/lint
156
157 # API fuzzer
158
159 api_SOURCES = api.c fuzz.c
160 api_LDFLAGS = -fsanitize=fuzzer
161
162 fuzz-api: api$(EXEEXT)
163 @mkdir -p corpus/api
164 ./api$(EXEEXT) \
165 -max_len=100 \
166 $$XML_FUZZ_OPTIONS \
167 corpus/api
168
169 # Regexp fuzzer
170
171 seed/regexp.stamp:
172 @mkdir -p seed/regexp
173 cp -r $(srcdir)/static_seed/regexp seed
174 @touch seed/regexp.stamp
175
176 regexp_SOURCES = regexp.c fuzz.c
177 regexp_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
178
179 fuzz-regexp: regexp$(EXEEXT) seed/regexp.stamp
180 @mkdir -p corpus/regexp
181 ./regexp$(EXEEXT) \
182 -dict=$(srcdir)/regexp.dict \
183 -max_len=200 \
184 $$XML_FUZZ_OPTIONS \
185 corpus/regexp seed/regexp
186
187 # URI fuzzer
188
189 seed/uri.stamp:
190 @mkdir -p seed/uri
191 cp -r $(srcdir)/static_seed/uri seed
192 @touch seed/uri.stamp
193
194 uri_SOURCES = uri.c fuzz.c
195 uri_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
196
197 fuzz-uri: uri$(EXEEXT) seed/uri.stamp
198 @mkdir -p corpus/uri
199 ./uri$(EXEEXT) \
200 -max_len=10000 \
201 $$XML_FUZZ_OPTIONS \
202 corpus/uri seed/uri
203
204 # XML Schema fuzzer
205
206 seed/schema.stamp: genSeed$(EXEEXT)
207 @mkdir -p seed/schema
208 ./genSeed$(EXEEXT) schema '$(top_srcdir)/test/schemas/*.xsd'
209 @touch seed/schema.stamp
210
211 schema_SOURCES = schema.c fuzz.c
212 schema_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
213
214 fuzz-schema: schema$(EXEEXT) seed/schema.stamp
215 @mkdir -p corpus/schema
216 ./schema$(EXEEXT) \
217 -dict=$(srcdir)/schema.dict \
218 -max_len=$(XML_MAX_LEN) \
219 $$XML_FUZZ_OPTIONS \
220 corpus/schema seed/schema
221
222 # XPath fuzzer
223
224 seed/xpath.stamp: genSeed$(EXEEXT)
225 @mkdir -p seed/xpath
226 ./genSeed$(EXEEXT) xpath '$(top_srcdir)/test/XPath'
227 @touch seed/xpath.stamp
228
229 xpath_SOURCES = xpath.c fuzz.c
230 xpath_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
231
232 fuzz-xpath: xpath$(EXEEXT) seed/xpath.stamp
233 @mkdir -p corpus/xpath
234 ./xpath$(EXEEXT) \
235 -dict=$(srcdir)/xpath.dict \
236 -max_len=10000 \
237 $$XML_FUZZ_OPTIONS \
238 corpus/xpath seed/xpath
239