[usrsctp] Add fuzzer for usrsctp (#4318)

* merge a new fuzzer o

* merge a new fuzzer of usrsctp
This commit is contained in:
Yuquan Wang 2020-08-13 23:52:50 +00:00 committed by GitHub
parent 5125d29c64
commit ae2d4de73a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 5 deletions

View File

@ -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