oss-fuzz/projects/nginx/make_fuzzers

40 lines
1.4 KiB
Plaintext

sed -i 's/main(/fuzz_without_main(/g' src/core/nginx.c
mkdir -p $NGX_OBJS/src/fuzz
ngx_all_objs_fuzz=`echo src/fuzz/wrappers.c $ngx_all_srcs \
| sed -e "s#\([^ ]*\.\)cc#$NGX_OBJS\/\1$ngx_objext#g" \
-e "s#\([^ ]*\.\)c#$NGX_OBJS\/\1$ngx_objext#g"`
ngx_deps_fuzz=`echo $ngx_all_objs_fuzz $ngx_modules_obj $ngx_res $LINK_DEPS \
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
-e "s/\//$ngx_regex_dirsep/g"`
ngx_objs=`echo objs/src/fuzz/wrappers.o $ngx_all_objs $ngx_modules_obj \
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_long_regex_cont\1/g" \
-e "s/\//$ngx_regex_dirsep/g"`
cat << END >> $NGX_MAKEFILE
fuzzers: objs/http_request_fuzzer
objs/src/fuzz/wrappers.o:
\$(CC) $ngx_compile_opt \$(CFLAGS) -o objs/src/fuzz/wrappers.o src/fuzz/wrappers.c
objs/http_request_fuzzer: $ngx_deps_fuzz
\$(CXX) \$(CXXFLAGS) src/fuzz/http_request_fuzzer.cc \
src/fuzz/genfiles/http_request_proto.pb.cc \
-o objs/http_request_fuzzer \
\$(CORE_INCS) \$(HTTP_INCS) \
-I src/fuzz/genfiles/ -I \$(SRC)/ \
-I \$(SRC)/libprotobuf-mutator/ \
-I \$(SRC)/LPM/external.protobuf/include \
\$(SRC)/LPM/src/libfuzzer/libprotobuf-mutator-libfuzzer.a \
\$(SRC)/LPM/src/libprotobuf-mutator.a \
\$(SRC)/LPM/external.protobuf/lib/libprotobuf.a \
$ngx_binexit$ngx_long_cont$ngx_objs \
\$(LIB_FUZZING_ENGINE) $ngx_libs$ngx_link$ngx_main_link -lcrypt
$ngx_long_end
END