github.com/quic-go/quic-go@v0.44.0/oss-fuzz.sh (about)

     1  #!/bin/bash
     2  
     3  # Install Go manually, since oss-fuzz ships with an outdated Go version.
     4  # See https://github.com/google/oss-fuzz/pull/10643.
     5  export CXX="${CXX} -lresolv" # required by Go 1.20
     6  wget https://go.dev/dl/go1.22.0.linux-amd64.tar.gz \
     7    && mkdir temp-go \
     8    && rm -rf /root/.go/* \
     9    && tar -C temp-go/ -xzf go1.22.0.linux-amd64.tar.gz \
    10    && mv temp-go/go/* /root/.go/ \
    11    && rm -rf temp-go go1.22.0.linux-amd64.tar.gz
    12  
    13  (
    14  # fuzz qpack
    15  compile_go_fuzzer github.com/quic-go/qpack/fuzzing Fuzz qpack_fuzzer
    16  )
    17  
    18  (
    19  # fuzz quic-go
    20  compile_go_fuzzer github.com/quic-go/quic-go/fuzzing/frames Fuzz frame_fuzzer
    21  compile_go_fuzzer github.com/quic-go/quic-go/fuzzing/header Fuzz header_fuzzer
    22  compile_go_fuzzer github.com/quic-go/quic-go/fuzzing/transportparameters Fuzz transportparameter_fuzzer
    23  compile_go_fuzzer github.com/quic-go/quic-go/fuzzing/tokens Fuzz token_fuzzer
    24  compile_go_fuzzer github.com/quic-go/quic-go/fuzzing/handshake Fuzz handshake_fuzzer
    25  
    26  if [ $SANITIZER == "coverage" ]; then
    27      # no need for corpora if coverage
    28      exit 0
    29  fi
    30  
    31  # generate seed corpora
    32  cd $GOPATH/src/github.com/quic-go/quic-go/
    33  go generate -x ./fuzzing/...
    34  
    35  zip --quiet -r $OUT/header_fuzzer_seed_corpus.zip fuzzing/header/corpus
    36  zip --quiet -r $OUT/frame_fuzzer_seed_corpus.zip fuzzing/frames/corpus
    37  zip --quiet -r $OUT/transportparameter_fuzzer_seed_corpus.zip fuzzing/transportparameters/corpus
    38  zip --quiet -r $OUT/handshake_fuzzer_seed_corpus.zip fuzzing/handshake/corpus
    39  )
    40  
    41  # for debugging
    42  ls -al $OUT