From ae2d4de73a8f173a5336683ee485e86eaf55ec13 Mon Sep 17 00:00:00 2001 From: Yuquan Wang Date: Thu, 13 Aug 2020 23:52:50 +0000 Subject: [PATCH] [usrsctp] Add fuzzer for usrsctp (#4318) * merge a new fuzzer o * merge a new fuzzer of usrsctp --- projects/usrsctp/build.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/projects/usrsctp/build.sh b/projects/usrsctp/build.sh index c3e35ca02..ddac90098 100755 --- a/projects/usrsctp/build.sh +++ b/projects/usrsctp/build.sh @@ -19,13 +19,21 @@ cmake -Dsctp_build_programs=0 -Dsctp_debug=0 -Dsctp_invariants=1 -Dsctp_build_fu make -j$(nproc) cd fuzzer -TARGETS="fuzzer_connect fuzzer_listen" +TARGETS="fuzzer_connect fuzzer_listen fuzzer_fragment" + +CORPUS="CORPUS_CONNECT CORPUS_LISTEN CORPUS_FRAGMENT" + +while [ -n "$TARGETS" ] +do + target=`echo "$TARGETS" | cut -d ' ' -f 1` + TARGETS=`echo "$TARGETS" | sed 's/[^ ]* *\(.*\)$/\1/'` + corpus=`echo "$CORPUS" | cut -d ' ' -f 1` + CORPUS=`echo "$CORPUS" | sed 's/[^ ]* *\(.*\)$/\1/'` -for target in $TARGETS; do $CC $CFLAGS -DFUZZING_STAGE=0 -I . -I ../usrsctplib/ -c ${target}.c -o $OUT/${target}.o $CXX $CXXFLAGS -o $OUT/${target} $OUT/${target}.o $LIB_FUZZING_ENGINE ../usrsctplib/libusrsctp.a rm -f $OUT/${target}.o -done -zip -jr fuzzer_connect_seed_corpus.zip CORPUS_CONNECT/ -cp fuzzer_connect_seed_corpus.zip $OUT/ + zip -jr ${target}_seed_corpus.zip ${corpus}/ + cp ${target}_seed_corpus.zip $OUT/ +done