aboutsummaryrefslogtreecommitdiff
path: root/tests/fuzz
diff options
context:
space:
mode:
Diffstat (limited to 'tests/fuzz')
-rw-r--r--tests/fuzz/Makefile.am37
-rw-r--r--tests/fuzz/Makefile.inc26
-rw-r--r--tests/fuzz/corpora/ftp/long1.txt8
-rw-r--r--tests/fuzz/corpora/http1_1/200_ok.txt13
-rw-r--r--tests/fuzz/corpora/http1_1/404_nf.txt9
5 files changed, 78 insertions, 15 deletions
diff --git a/tests/fuzz/Makefile.am b/tests/fuzz/Makefile.am
index 487deff41..0d20d792a 100644
--- a/tests/fuzz/Makefile.am
+++ b/tests/fuzz/Makefile.am
@@ -5,7 +5,7 @@
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
-# Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+# Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
@@ -19,6 +19,39 @@
# KIND, either express or implied.
#
###########################################################################
+AUTOMAKE_OPTIONS = foreign nostdinc
+# Specify our include paths here, and do it relative to $(top_srcdir) and
+# $(top_builddir), to ensure that these paths which belong to the library
+# being currently built and tested are searched before the library which
+# might possibly already be installed in the system.
+#
+# $(top_builddir)/include/curl for generated curlbuild.h included from curl.h
+# $(top_builddir)/include for generated curlbuild.h inc. from lib/curl_setup.h
+# $(top_srcdir)/include is for libcurl's external include files
+# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file
+# $(top_srcdir)/lib for libcurl's lib/curl_setup.h and other "borrowed" files
+
+AM_CPPFLAGS = -I$(top_builddir)/include/curl \
+ -I$(top_builddir)/include \
+ -I$(top_srcdir)/include \
+ -I$(top_builddir)/lib \
+ -I$(top_srcdir)/lib \
+ -I$(top_srcdir)/tests/fuzz
+
+EXTRA_DIST = Makefile.inc CMakeLists.txt
+
+LIBS = -lpthread -lFuzzer -lstdc++ -lm
+LDFLAGS = -L/usr/lib/llvm-5.0/lib #-L/home/daniel/src/Fuzzer/
+
+LDADD = $(top_builddir)/lib/libcurl.la \
+ @LDFLAGS@ @LIBCURL_LIBS@
+
+# Makefile.inc provides neat definitions
+include Makefile.inc
+
+checksrc:
+ @PERL@ $(top_srcdir)/lib/checksrc.pl $(srcdir)/*.c
+
+noinst_PROGRAMS = $(FUZZPROGS)
-# FIXME, probably adapt from file in ../unit
diff --git a/tests/fuzz/Makefile.inc b/tests/fuzz/Makefile.inc
index fa4ae1c7d..fb6cdb11a 100644
--- a/tests/fuzz/Makefile.inc
+++ b/tests/fuzz/Makefile.inc
@@ -1,19 +1,19 @@
-FUZZER_HTTP11 = curl_fuzzer.c
-FUZZER_HTTP11_CPPFLAGS = $(AM_CPPFLAGS)
+FUZZPROGS = http11 ftp imap pop3 httpupload http2
+http11_SOURCES = curl_fuzzer.c
+http11_CPPFLAGS = $(AM_CPPFLAGS)
-FUZZER_FTP = curl_fuzzer.c
-FUZZER_FTP_CPPFLAGS = -DFUZZER_FTP $(AM_CPPFLAGS)
+ftp_SOURCES = curl_fuzzer.c
+ftp_CPPFLAGS = -DFUZZER_FTP $(AM_CPPFLAGS)
-FUZZER_IMAP = curl_fuzzer.c
-FUZZER_IMAP_CPPFLAGS = -DFUZZER_IMAP $(AM_CPPFLAGS)
+imap_SOURCES = curl_fuzzer.c
+imap_CPPFLAGS = -DFUZZER_IMAP $(AM_CPPFLAGS)
-FUZZER_POP3 = curl_fuzzer.c
-FUZZER_POP3_CPPFLAGS = -DFUZZER_POP3 $(AM_CPPFLAGS)
+pop3_SOURCES = curl_fuzzer.c
+pop3_CPPFLAGS = -DFUZZER_POP3 $(AM_CPPFLAGS)
-FUZZER_HTTP_UPLOAD = curl_fuzzer.c
-FUZZER_HTTP_UPLOAD_CPPFLAGS = -DFUZZER_HTTP_UPLOAD $(AM_CPPFLAGS)
+httpupload_SOURCES = curl_fuzzer.c
+httpupload_CPPFLAGS = -DFUZZER_HTTP_UPLOAD $(AM_CPPFLAGS)
-
-FUZZER_HTTP2 = curl_fuzzer.c
-FUZZER_HTTP2_CPPFLAGS = -DFUZZER_HTTP2 $(AM_CPPFLAGS)
+http2_SOURCES = curl_fuzzer.c
+http2_CPPFLAGS = -DFUZZER_HTTP2 $(AM_CPPFLAGS)
diff --git a/tests/fuzz/corpora/ftp/long1.txt b/tests/fuzz/corpora/ftp/long1.txt
new file mode 100644
index 000000000..47a536e38
--- /dev/null
+++ b/tests/fuzz/corpora/ftp/long1.txt
@@ -0,0 +1,8 @@
+200 OK
+200 OK
+215 UNIX Type: L8
+200 OK
+200 OK
+200 OK
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+220 OK
diff --git a/tests/fuzz/corpora/http1_1/200_ok.txt b/tests/fuzz/corpora/http1_1/200_ok.txt
new file mode 100644
index 000000000..ca7ef0b23
--- /dev/null
+++ b/tests/fuzz/corpora/http1_1/200_ok.txt
@@ -0,0 +1,13 @@
+HTTP/1.1 200 OK
+Content-Encoding: gzip
+Accept-Ranges: bytes
+Cache-Control: max-age=604800
+Content-Type: text/html
+Date: Mon, 08 May 2017 19:03:58 GMT
+Etag: "359670651+gzip"
+Expires: Mon, 15 May 2017 19:03:58 GMT
+Last-Modified: Fri, 09 Aug 2013 23:54:35 GMT
+Server: ECS (ewr/15BD)
+X-Cache: HIT
+Content-Length: 606
+
diff --git a/tests/fuzz/corpora/http1_1/404_nf.txt b/tests/fuzz/corpora/http1_1/404_nf.txt
new file mode 100644
index 000000000..a28311a35
--- /dev/null
+++ b/tests/fuzz/corpora/http1_1/404_nf.txt
@@ -0,0 +1,9 @@
+HTTP/1.1 404 Not Found
+Cache-Control: max-age=604800
+Content-Type: text/html
+Date: Mon, 08 May 2017 19:04:08 GMT
+Expires: Mon, 15 May 2017 19:04:08 GMT
+Server: EOS (lax004/28A3)
+Vary: Accept-Encoding
+Content-Length: 1270
+