fuzz: add fuzzers to test reader_util code (#2080)
This commit is contained in:
+45
-1
@@ -9,6 +9,8 @@ bin_PROGRAMS += fuzz_libinjection
|
||||
bin_PROGRAMS += fuzz_gcrypt_light
|
||||
#Configuration files
|
||||
bin_PROGRAMS += fuzz_filecfg_protocols
|
||||
#Reader utils
|
||||
bin_PROGRAMS += fuzz_readerutils_workflow fuzz_readerutils_parseprotolist
|
||||
|
||||
fuzz_process_packet_SOURCES = fuzz_process_packet.c fuzz_common_code.c
|
||||
fuzz_process_packet_CFLAGS = @NDPI_CFLAGS@ $(CXXFLAGS)
|
||||
@@ -393,6 +395,36 @@ fuzz_filecfg_protocols_LINK=$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXX) @NDPI_CFLAGS@ $(AM_CXXFLAGS) $(CXXFLAGS) \
|
||||
$(fuzz_filecfg_protocols_LDFLAGS) @NDPI_LDFLAGS@ $(LDFLAGS) -o $@
|
||||
|
||||
fuzz_readerutils_workflow_SOURCES = fuzz_readerutils_workflow.cpp fuzz_common_code.c ../example/reader_util.c
|
||||
fuzz_readerutils_workflow_CXXFLAGS = -I../example/ @NDPI_CFLAGS@ $(CXXFLAGS)
|
||||
fuzz_readerutils_workflow_CFLAGS = @NDPI_CFLAGS@ $(CXXFLAGS)
|
||||
fuzz_readerutils_workflow_LDADD = ../src/lib/libndpi.a $(ADDITIONAL_LIBS)
|
||||
fuzz_readerutils_workflow_LDFLAGS = $(PCAP_LIB) $(LIBS)
|
||||
if HAS_FUZZLDFLAGS
|
||||
fuzz_readerutils_workflow_CXXFLAGS += $(LIB_FUZZING_ENGINE)
|
||||
fuzz_readerutils_workflow_CFLAGS += $(LIB_FUZZING_ENGINE)
|
||||
fuzz_readerutils_workflow_LDFLAGS += $(LIB_FUZZING_ENGINE)
|
||||
endif
|
||||
# force usage of CXX for linker
|
||||
fuzz_readerutils_workflow_LINK=$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXX) @NDPI_CFLAGS@ $(AM_CXXFLAGS) $(CXXFLAGS) \
|
||||
$(fuzz_readerutils_workflow_LDFLAGS) @NDPI_LDFLAGS@ $(LDFLAGS) -o $@
|
||||
|
||||
fuzz_readerutils_parseprotolist_SOURCES = fuzz_readerutils_parseprotolist.cpp fuzz_common_code.c ../example/reader_util.c
|
||||
fuzz_readerutils_parseprotolist_CXXFLAGS = -I../example/ @NDPI_CFLAGS@ $(CXXFLAGS)
|
||||
fuzz_readerutils_parseprotolist_CFLAGS = @NDPI_CFLAGS@ $(CXXFLAGS)
|
||||
fuzz_readerutils_parseprotolist_LDADD = ../src/lib/libndpi.a $(ADDITIONAL_LIBS)
|
||||
fuzz_readerutils_parseprotolist_LDFLAGS = $(PCAP_LIB) $(LIBS)
|
||||
if HAS_FUZZLDFLAGS
|
||||
fuzz_readerutils_parseprotolist_CXXFLAGS += $(LIB_FUZZING_ENGINE)
|
||||
fuzz_readerutils_parseprotolist_CFLAGS += $(LIB_FUZZING_ENGINE)
|
||||
fuzz_readerutils_parseprotolist_LDFLAGS += $(LIB_FUZZING_ENGINE)
|
||||
endif
|
||||
# force usage of CXX for linker
|
||||
fuzz_readerutils_parseprotolist_LINK=$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXX) @NDPI_CFLAGS@ $(AM_CXXFLAGS) $(CXXFLAGS) \
|
||||
$(fuzz_readerutils_parseprotolist_LDFLAGS) @NDPI_LDFLAGS@ $(LDFLAGS) -o $@
|
||||
|
||||
|
||||
# required for Google oss-fuzz
|
||||
# see https://github.com/google/oss-fuzz/tree/master/projects/ndpi
|
||||
@@ -502,7 +534,17 @@ files_corpus_fuzz_filecfg_protocols := $(wildcard corpus/fuzz_filecfg_protocols
|
||||
fuzz_filecfg_protocols_seed_corpus.zip: $(files_corpus_fuzz_filecfg_protocols)
|
||||
zip -j fuzz_filecfg_protocols_seed_corpus.zip $(files_corpus_fuzz_filecfg_protocols)
|
||||
|
||||
corpus: fuzz_ndpi_reader_seed_corpus.zip fuzz_ndpi_reader_alloc_fail_seed_corpus.zip fuzz_ndpi_reader_payload_analyzer_seed_corpus.zip fuzz_quic_get_crypto_data_seed_corpus.zip fuzz_config_seed_corpus.zip fuzz_ds_patricia_seed_corpus.zip fuzz_ds_ahocorasick_seed_corpus.zip fuzz_alg_ses_des_seed_corpus.zip fuzz_alg_hw_rsi_outliers_da_seed_corpus.zip fuzz_alg_bins_seed_corpus.zip fuzz_alg_hll_seed_corpus.zip fuzz_alg_jitter_seed_corpus.zip fuzz_ds_libcache_seed_corpus.zip fuzz_community_id_seed_corpus.zip fuzz_ds_tree_seed_corpus.zip fuzz_serialization_seed_corpus.zip fuzz_ds_ptree_seed_corpus.zip fuzz_alg_crc32_md5_seed_corpus.zip fuzz_alg_bytestream_seed_corpus.zip fuzz_libinjection_seed_corpus.zip fuzz_tls_certificate_seed_corpus.zip fuzz_filecfg_protocols_seed_corpus.zip
|
||||
files_corpus_fuzz_readerutils_workflow := $(wildcard corpus/fuzz_readerutils_workflow/*)
|
||||
|
||||
fuzz_readerutils_workflow_seed_corpus.zip: $(files_corpus_fuzz_readerutils_workflow)
|
||||
zip -j fuzz_readerutils_workflow_seed_corpus.zip $(files_corpus_fuzz_readerutils_workflow)
|
||||
|
||||
files_corpus_fuzz_readerutils_parseprotolist := $(wildcard corpus/fuzz_readerutils_parseprotolist/*)
|
||||
|
||||
fuzz_readerutils_parseprotolist_seed_corpus.zip: $(files_corpus_fuzz_readerutils_parseprotolist)
|
||||
zip -j fuzz_readerutils_parseprotolist_seed_corpus.zip $(files_corpus_fuzz_readerutils_parseprotolist)
|
||||
|
||||
corpus: fuzz_ndpi_reader_seed_corpus.zip fuzz_ndpi_reader_alloc_fail_seed_corpus.zip fuzz_ndpi_reader_payload_analyzer_seed_corpus.zip fuzz_quic_get_crypto_data_seed_corpus.zip fuzz_config_seed_corpus.zip fuzz_ds_patricia_seed_corpus.zip fuzz_ds_ahocorasick_seed_corpus.zip fuzz_alg_ses_des_seed_corpus.zip fuzz_alg_hw_rsi_outliers_da_seed_corpus.zip fuzz_alg_bins_seed_corpus.zip fuzz_alg_hll_seed_corpus.zip fuzz_alg_jitter_seed_corpus.zip fuzz_ds_libcache_seed_corpus.zip fuzz_community_id_seed_corpus.zip fuzz_ds_tree_seed_corpus.zip fuzz_serialization_seed_corpus.zip fuzz_ds_ptree_seed_corpus.zip fuzz_alg_crc32_md5_seed_corpus.zip fuzz_alg_bytestream_seed_corpus.zip fuzz_libinjection_seed_corpus.zip fuzz_tls_certificate_seed_corpus.zip fuzz_filecfg_protocols_seed_corpus.zip fuzz_readerutils_workflow_seed_corpus.zip fuzz_readerutils_parseprotolist_seed_corpus.zip
|
||||
cp corpus/fuzz_*seed_corpus.zip .
|
||||
|
||||
#Create dictionaries exactly as expected by oss-fuzz.
|
||||
@@ -529,6 +571,8 @@ distdir:
|
||||
-o -path './corpus/fuzz_*.zip' \
|
||||
-o -path './corpus/fuzz_quic_get_crypto_data/*' \
|
||||
-o -path './corpus/fuzz_filecfg_protocols/*' \
|
||||
-o -path './corpus/fuzz_readerutils_workflow/*' \
|
||||
-o -path './corpus/fuzz_readerutils_parseprotolist/*' \
|
||||
-o -path './corpus/fuzz_config/*' \
|
||||
-o -path './corpus/fuzz_serialization/*' \
|
||||
-o -path './corpus/fuzz_community_id/*' \
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
all
|
||||
@@ -0,0 +1 @@
|
||||
foo
|
||||
@@ -0,0 +1 @@
|
||||
-,"ovpn,"
|
||||
@@ -0,0 +1 @@
|
||||
foo
|
||||
@@ -0,0 +1 @@
|
||||
foo bar
|
||||
@@ -0,0 +1 @@
|
||||
-openvpn
|
||||
@@ -0,0 +1 @@
|
||||
-openvpn;
|
||||
@@ -0,0 +1 @@
|
||||
-openvpn;all
|
||||
@@ -0,0 +1 @@
|
||||
-http\t--dns
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
all;
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
-ovpn
|
||||
@@ -0,0 +1 @@
|
||||
quic;http
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
quic;„p,
|
||||
@@ -0,0 +1 @@
|
||||
-ovpn
|
||||
@@ -0,0 +1 @@
|
||||
quic;http,
|
||||
@@ -0,0 +1 @@
|
||||
,quic;http,
|
||||
@@ -0,0 +1 @@
|
||||
alq
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
all;all;
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
,quic;http,+all
|
||||
@@ -0,0 +1 @@
|
||||
quic;tthttp,
|
||||
@@ -0,0 +1 @@
|
||||
,quic;http,-all
|
||||
@@ -0,0 +1 @@
|
||||
,quic;http,-a
|
||||
@@ -0,0 +1 @@
|
||||
all,+dns
|
||||
@@ -0,0 +1 @@
|
||||
-,"ovpn,"
|
||||
@@ -0,0 +1 @@
|
||||
all,unknown
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
quic,
|
||||
@@ -0,0 +1,2 @@
|
||||
all,+dns
|
||||
)
|
||||
@@ -0,0 +1 @@
|
||||
OICQ foo
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
qalulij
|
||||
@@ -0,0 +1 @@
|
||||
lal
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user