fixed fuzzing tests in a way that ./tests/do.sh is now able to use corpus *.pcap files from ./tests/pcap
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
+3
-7
@@ -1,8 +1,10 @@
|
|||||||
bin_PROGRAMS = fuzz_process_packet fuzz_ndpi_reader
|
bin_PROGRAMS = fuzz_process_packet fuzz_ndpi_reader
|
||||||
|
|
||||||
fuzz_process_packet_SOURCES = fuzz_process_packet.c
|
fuzz_process_packet_SOURCES = fuzz_process_packet.c
|
||||||
|
fuzz_process_packet_CFLAGS =
|
||||||
fuzz_process_packet_LDFLAGS = ../src/lib/libndpi.a $(ADDITIONAL_LIBS)
|
fuzz_process_packet_LDFLAGS = ../src/lib/libndpi.a $(ADDITIONAL_LIBS)
|
||||||
if HAS_FUZZLDFLAGS
|
if HAS_FUZZLDFLAGS
|
||||||
|
fuzz_process_packet_CFLAGS += $(LIB_FUZZING_ENGINE)
|
||||||
fuzz_process_packet_LDFLAGS += $(LIB_FUZZING_ENGINE)
|
fuzz_process_packet_LDFLAGS += $(LIB_FUZZING_ENGINE)
|
||||||
#else
|
#else
|
||||||
# fuzz_process_packet_SOURCES += onefile.c
|
# fuzz_process_packet_SOURCES += onefile.c
|
||||||
@@ -16,6 +18,7 @@ fuzz_ndpi_reader_SOURCES = fuzz_ndpi_reader.c
|
|||||||
fuzz_ndpi_reader_CFLAGS = -I../example/
|
fuzz_ndpi_reader_CFLAGS = -I../example/
|
||||||
fuzz_ndpi_reader_LDFLAGS = ../example/libndpiReader.a ../src/lib/libndpi.a $(PCAP_LIB) $(ADDITIONAL_LIBS)
|
fuzz_ndpi_reader_LDFLAGS = ../example/libndpiReader.a ../src/lib/libndpi.a $(PCAP_LIB) $(ADDITIONAL_LIBS)
|
||||||
if HAS_FUZZLDFLAGS
|
if HAS_FUZZLDFLAGS
|
||||||
|
fuzz_ndpi_reader_CFLAGS += $(LIB_FUZZING_ENGINE)
|
||||||
fuzz_ndpi_reader_LDFLAGS += $(LIB_FUZZING_ENGINE)
|
fuzz_ndpi_reader_LDFLAGS += $(LIB_FUZZING_ENGINE)
|
||||||
#else
|
#else
|
||||||
# fuzz_ndpi_reader_SOURCES += onefile.c
|
# fuzz_ndpi_reader_SOURCES += onefile.c
|
||||||
@@ -24,10 +27,3 @@ endif
|
|||||||
fuzz_ndpi_reader_LINK=$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
fuzz_ndpi_reader_LINK=$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||||
$(LIBTOOLFLAGS) --mode=link $(CXX) $(AM_CXXFLAGS) $(CXXFLAGS) \
|
$(LIBTOOLFLAGS) --mode=link $(CXX) $(AM_CXXFLAGS) $(CXXFLAGS) \
|
||||||
$(fuzz_ndpi_reader_LDFLAGS) $(LDFLAGS) -o $@
|
$(fuzz_ndpi_reader_LDFLAGS) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
EXTRA_fuzz_ndpi_reader_DEPENDENCIES = fuzz_ndpi_reader_seed_corpus.zip
|
|
||||||
|
|
||||||
testpcaps := $(wildcard ../tests/pcap/*.pcap)
|
|
||||||
|
|
||||||
fuzz_ndpi_reader_seed_corpus.zip: $(testpcaps)
|
|
||||||
zip -r fuzz_ndpi_reader_seed_corpus.zip $(testpcaps)
|
|
||||||
|
|||||||
+7
-4
@@ -7,6 +7,12 @@ READER="../example/ndpiReader -p ../example/protos.txt -c ../example/categories.
|
|||||||
RC=0
|
RC=0
|
||||||
PCAPS=`cd pcap; /bin/ls *.pcap`
|
PCAPS=`cd pcap; /bin/ls *.pcap`
|
||||||
|
|
||||||
|
fuzzy_testing() {
|
||||||
|
if [ -f ../fuzz/fuzz_ndpi_reader ]; then
|
||||||
|
../fuzz/fuzz_ndpi_reader -max_total_time=592 -print_pcs=1 -jobs=1 -workers=1 pcap/
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
build_results() {
|
build_results() {
|
||||||
for f in $PCAPS; do
|
for f in $PCAPS; do
|
||||||
#echo $f
|
#echo $f
|
||||||
@@ -15,10 +21,6 @@ build_results() {
|
|||||||
CMD="$READER -q -t -i pcap/$f -w result/$f.out -v 2"
|
CMD="$READER -q -t -i pcap/$f -w result/$f.out -v 2"
|
||||||
$CMD
|
$CMD
|
||||||
fi
|
fi
|
||||||
# test fuzz target built with sanitizer on input from corpus
|
|
||||||
if [ -f ../fuzz/fuzz_ndpi_reader ]; then
|
|
||||||
../fuzz/fuzz_ndpi_reader pcap/$f
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,6 +45,7 @@ check_results() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fuzzy_testing
|
||||||
build_results
|
build_results
|
||||||
check_results
|
check_results
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user