@@ -251,16 +251,35 @@ test_proxy_mbedtls : test_proxy.cc ../httplib.h Makefile cert.pem
251251test_proxy_wolfssl : test_proxy.cc ../httplib.h Makefile cert.pem
252252 $(CXX ) -o $@ -I.. $(CXXFLAGS ) test_proxy.cc $(TEST_ARGS_WOLFSSL )
253253
254- # Runs server_fuzzer.cc based on value of $(LIB_FUZZING_ENGINE).
255- # Usage: make fuzz_test LIB_FUZZING_ENGINE=/path/to/libFuzzer
256- fuzz_test : server_fuzzer
257- ./server_fuzzer fuzzing/corpus/*
254+ # Runs all fuzz harnesses based on the value of $(LIB_FUZZING_ENGINE).
255+ # By default LIB_FUZZING_ENGINE is standalone_fuzz_target_runner.o, so each
256+ # fuzzer is replayed over its regression corpus.
257+ # Override for actual fuzzing:
258+ # make fuzz_test LIB_FUZZING_ENGINE=/path/to/libFuzzer
259+ fuzz_test : server_fuzzer client_fuzzer header_parser_fuzzer url_parser_fuzzer
260+ ./server_fuzzer fuzzing/corpus/[0-9]* fuzzing/corpus/issue1264 fuzzing/corpus/clusterfuzz-testcase-minimized-server_fuzzer-*
261+ ./client_fuzzer fuzzing/corpus/clusterfuzz-testcase-minimized-client_fuzzer-*
262+ ./header_parser_fuzzer fuzzing/corpus/clusterfuzz-testcase-minimized-header_parser_fuzzer-*
263+ @matches=$$(find fuzzing/corpus -maxdepth 1 -type f -name 'clusterfuzz-testcase-minimized-url_parser_fuzzer-*' ) ; \
264+ if [ -n " $$ matches" ]; then ./url_parser_fuzzer $$ matches; else echo " (no url_parser_fuzzer corpus)" ; fi
258265
259266# Fuzz target, so that you can choose which $(LIB_FUZZING_ENGINE) to use.
260267server_fuzzer : fuzzing/server_fuzzer.cc ../httplib.h standalone_fuzz_target_runner.o
261268 $(CXX ) -o $@ -I.. $(CXXFLAGS ) $< $(OPENSSL_SUPPORT ) $(ZLIB_SUPPORT ) $(BROTLI_SUPPORT ) $(LIB_FUZZING_ENGINE ) $(ZSTD_SUPPORT ) $(LIBS )
262269 @file $@
263270
271+ client_fuzzer : fuzzing/client_fuzzer.cc ../httplib.h standalone_fuzz_target_runner.o
272+ $(CXX ) -o $@ -I.. $(CXXFLAGS ) $< $(OPENSSL_SUPPORT ) $(ZLIB_SUPPORT ) $(BROTLI_SUPPORT ) $(LIB_FUZZING_ENGINE ) $(ZSTD_SUPPORT ) $(LIBS )
273+ @file $@
274+
275+ header_parser_fuzzer : fuzzing/header_parser_fuzzer.cc ../httplib.h standalone_fuzz_target_runner.o
276+ $(CXX ) -o $@ -I.. $(CXXFLAGS ) $< $(OPENSSL_SUPPORT ) $(ZLIB_SUPPORT ) $(BROTLI_SUPPORT ) $(LIB_FUZZING_ENGINE ) $(ZSTD_SUPPORT ) $(LIBS )
277+ @file $@
278+
279+ url_parser_fuzzer : fuzzing/url_parser_fuzzer.cc ../httplib.h standalone_fuzz_target_runner.o
280+ $(CXX ) -o $@ -I.. $(CXXFLAGS ) $< $(OPENSSL_SUPPORT ) $(ZLIB_SUPPORT ) $(BROTLI_SUPPORT ) $(LIB_FUZZING_ENGINE ) $(ZSTD_SUPPORT ) $(LIBS )
281+ @file $@
282+
264283# Standalone fuzz runner, which just reads inputs from fuzzing/corpus/ dir and
265284# feeds it to server_fuzzer.
266285standalone_fuzz_target_runner.o : fuzzing/standalone_fuzz_target_runner.cpp
@@ -273,5 +292,5 @@ cert.pem:
273292 ./gen-certs.sh
274293
275294clean :
276- rm -rf test test_split test_mbedtls test_split_mbedtls test_wolfssl test_split_wolfssl test_no_tls, test_split_no_tls test_proxy test_proxy_mbedtls test_proxy_wolfssl test_benchmark server_fuzzer * .pem * .0 * .o * .1 * .srl httplib.h httplib.cc _build* * .dSYM * _shard_* .log cpp-httplib
295+ rm -rf test test_split test_mbedtls test_split_mbedtls test_wolfssl test_split_wolfssl test_no_tls, test_split_no_tls test_proxy test_proxy_mbedtls test_proxy_wolfssl test_benchmark server_fuzzer client_fuzzer header_parser_fuzzer url_parser_fuzzer * .pem * .0 * .o * .1 * .srl httplib.h httplib.cc _build* * .dSYM * _shard_* .log cpp-httplib
277296
0 commit comments