mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-28 06:59:33 +00:00
* First sketch of fuzzing * Add m4 script The script is used in the fuzzing build * Add stub sources in the makefile * [Fuzz] Add RedisStub * Add gitignore for fuzz dir * Remove definition of non-implemented method * [Fuzz] Refactoring code * [Fuzz] Separate the protobuf support in the makefile * Clean fuzzing related object files * [Fuzz] Fix makefile * Change gitignore * [Fuzz] Separate headers * [Fuzz] Add README.md * [Fuzz] Change make target * [Fuzz] Update README.md * Add compatibilty with autoconf < 2.71 * Optionally disable hiredis integration * Include hiredis only for production build * [Fuzz] Disable period activities * Remove unused dependencies for librrd * Optionally use static linking for zmq library * Add debug output regarding the linking of libzmq * [Fuzz] Do not run on empty input * Optionally use static linking for libjson-c * Optionally use static linking for libmaxminddb * Make mysqlclient dependency as optional * Change gitignore * [Fuzz] Add corpus for fuzz_dissect_packet * [Fuzz] Refactor fuzz_dissect_packet * Change gitignore * [Fuzz] Use correct naming for corpus * [Fuzz] Add dictionary * [Fuzz] Fix declaration of LLVMFuzzerInitialize * [Fuzz] Refactor onefile * [Fuzz] Fix the initialization memory leaks * [Fuzz] Fix invocation of LLVMFuzzerInitialize * Remove double githooks folder * [Fuzz] Set interface pcap_data_link * Change gitignore * Use pkg-config for detecting protobuf libraries * Add license * Improve error message
52 lines
No EOL
1.6 KiB
Makefile
52 lines
No EOL
1.6 KiB
Makefile
FUZZ_TARGETS := fuzz/fuzz_dissect_packet
|
|
FUZZ_CORPUS := $(addsuffix _seed_corpus.zip,$(FUZZ_TARGETS))
|
|
|
|
FUZZ_LOCAL_TEST := @FUZZ_LOCAL_TEST@
|
|
HAS_FUZZLDFLAGS := @HAS_FUZZLDFLAGS@
|
|
LIB_FUZZING_ENGINE := @LIB_FUZZING_ENGINE@
|
|
FUZZ_OBJECTS := @FUZZ_OBJECTS@
|
|
FUZZ_WITH_PROTOBUF := @FUZZ_WITH_PROTOBUF@
|
|
|
|
OBJECTS := $(OBJECTS) $(FUZZ_OBJECTS)
|
|
FUZZ_FILTER_OUT := $(FUZZ_OBJECTS:fuzz/stub/%Stub.o=src/%.o)
|
|
OBJECTS_NO_MAIN := $(filter-out src/main.o $(FUZZ_FILTER_OUT),$(OBJECTS))
|
|
|
|
# Protobuf dependencies
|
|
fuzz_dissect_packet_proto_sources := fuzz/proto/pcap.pb.o
|
|
|
|
ifneq ($(HAS_FUZZLDFLAGS),1)
|
|
CPPFLAGS := $(CPPFLAGS) -DINCLUDE_ONEFILE
|
|
else ifeq ($(FUZZ_LOCAL_TEST),1)
|
|
CPPFLAGS := $(CPPFLAGS) -DINCLUDE_ONEFILE
|
|
endif
|
|
|
|
ifeq ($(FUZZ_WITH_PROTOBUF),1)
|
|
LIBS := $(LIBS) @LIBPROTOBUF_MUTATOR_LIBS@ @PROTOBUF_LIBS@
|
|
CXXFLAGS := $(CXXFLAGS) @LIBPROTOBUF_MUTATOR_CFLAGS@ @PROTOBUF_CFLAGS@
|
|
CPPFLAGS := $(CPPFLAGS) -DFUZZ_WITH_PROTOBUF
|
|
else
|
|
fuzz_dissect_packet_proto_sources :=
|
|
endif
|
|
|
|
fuzz/proto/%.pb.o: fuzz/%.proto
|
|
mkdir fuzz/proto
|
|
cd fuzz && protoc --cpp_out=proto/ $*.proto
|
|
$(CXX) -c fuzz/proto/$*.pb.cc -o $@
|
|
|
|
fuzz/%.o: fuzz/%.cpp
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
|
|
|
|
fuzz/fuzz_dissect_packet: fuzz/fuzz_dissect_packet.o $(fuzz_dissect_packet_proto_sources) $(OBJECTS_NO_MAIN)
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(LIB_FUZZING_ENGINE) $^ $(LIBS) -o $@
|
|
|
|
fuzz/%: fuzz/%.o $(OBJECTS_NO_MAIN)
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(LIB_FUZZING_ENGINE) $^ $(LIBS) -o $@
|
|
|
|
fuzz_corpus: $(FUZZ_CORPUS)
|
|
|
|
fuzz_all: $(LIB_TARGETS) $(FUZZ_TARGETS) fuzz_corpus
|
|
|
|
.SECONDEXPANSION:
|
|
|
|
fuzz/fuzz_%_seed_corpus.zip: $$(wildcard fuzz/corpus/fuzz_%/*)
|
|
zip -j $@ $^
|