mirror of https://github.com/google/oss-fuzz.git
parent
b33c276c0d
commit
e944cdfbb8
|
@ -17,18 +17,10 @@
|
|||
FROM gcr.io/oss-fuzz-base/base-builder
|
||||
MAINTAINER guidovranken@gmail.com
|
||||
|
||||
RUN apt-get update && apt-get install -y software-properties-common python-software-properties build-essential wget
|
||||
|
||||
# Golang 1.9 binaries are downloaded only to bootstrap the latest Golang from the development repository
|
||||
RUN add-apt-repository -y ppa:gophers/archive && apt-get update && apt-get install -y golang-1.9-go
|
||||
RUN ln -s /usr/lib/go-1.9/bin/go /usr/bin/go
|
||||
|
||||
# Get latest Golang
|
||||
RUN git clone --depth 1 https://github.com/golang/go
|
||||
|
||||
RUN mkdir -p go/packages/src/github.com/dvyukov
|
||||
RUN cd go/packages/src/github.com/dvyukov && git clone https://github.com/dvyukov/go-fuzz
|
||||
RUN cd go/packages/src/github.com/dvyukov && git clone https://github.com/dvyukov/go-fuzz-corpus
|
||||
RUN mkdir -p $GOPATH/src/github.com/dvyukov/ && \
|
||||
cd $GOPATH/src/github.com/dvyukov/ && \
|
||||
git clone https://github.com/dvyukov/go-fuzz-corpus
|
||||
|
||||
COPY build.sh $SRC/
|
||||
|
||||
WORKDIR $SRC/golang
|
||||
|
|
|
@ -1,27 +1,8 @@
|
|||
# Compile latest Go
|
||||
cd go/src
|
||||
./make.bash
|
||||
cd $SRC
|
||||
|
||||
# Remove previous Go install (used for bootstrapping)
|
||||
apt-get remove golang-1.9-go -y
|
||||
rm /usr/bin/go
|
||||
|
||||
export GOROOT=`realpath go`
|
||||
export GOPATH=$GOROOT/packages
|
||||
export PATH=$GOROOT/bin:$PATH
|
||||
|
||||
# Dependency of go-fuzz
|
||||
go get golang.org/x/tools/go/packages
|
||||
|
||||
# go-fuzz-build is the tool that instruments Go files
|
||||
go build github.com/dvyukov/go-fuzz/go-fuzz-build
|
||||
|
||||
function compile_fuzzer {
|
||||
fuzzer=$(basename $1)
|
||||
|
||||
# Instrument all Go files relevant to this fuzzer, compile and store in $fuzzer.a
|
||||
./go-fuzz-build -libfuzzer -o $fuzzer.a github.com/dvyukov/go-fuzz-corpus/$fuzzer
|
||||
go-fuzz-build -libfuzzer -o $fuzzer.a github.com/dvyukov/go-fuzz-corpus/$fuzzer
|
||||
|
||||
# Instrumented, compiled Go ($fuzzer.a) + libFuzzer = fuzzer binary
|
||||
$CXX $CXXFLAGS -lFuzzingEngine $fuzzer.a -lpthread -o fuzzer-$fuzzer
|
||||
|
@ -30,7 +11,8 @@ function compile_fuzzer {
|
|||
cp fuzzer-$fuzzer $OUT
|
||||
|
||||
# Pack the seed corpus
|
||||
zip -r fuzzer-${fuzzer}_seed_corpus.zip $GOPATH/src/github.com/dvyukov/go-fuzz-corpus/$fuzzer/corpus
|
||||
zip -r fuzzer-${fuzzer}_seed_corpus.zip \
|
||||
$GOPATH/src/github.com/dvyukov/go-fuzz-corpus/$fuzzer/corpus
|
||||
|
||||
# Copy the seed corpus
|
||||
cp fuzzer-${fuzzer}_seed_corpus.zip $OUT
|
||||
|
@ -39,27 +21,28 @@ function compile_fuzzer {
|
|||
export -f compile_fuzzer
|
||||
|
||||
# Use this to attempt to compile all
|
||||
#find $GOPATH/src/github.com/dvyukov/go-fuzz-corpus -mindepth 1 -maxdepth 1 -type d -exec bash -c 'compile_fuzzer "$@"' bash {} \;
|
||||
#find $SRC/go-fuzz-corpus -mindepth 1 -maxdepth 1 -type d -exec bash -c 'compile_fuzzer "$@"' bash {} \;
|
||||
|
||||
compile_fuzzer asn1
|
||||
#compile_fuzzer bzip2
|
||||
compile_fuzzer csv
|
||||
compile_fuzzer elliptic
|
||||
compile_fuzzer flate
|
||||
compile_fuzzer fmt
|
||||
#compile_fuzzer gif
|
||||
compile_fuzzer gzip
|
||||
compile_fuzzer httpreq
|
||||
compile_fuzzer httpresp
|
||||
compile_fuzzer jpeg
|
||||
compile_fuzzer json
|
||||
compile_fuzzer lzw
|
||||
compile_fuzzer mime
|
||||
compile_fuzzer multipart
|
||||
compile_fuzzer png
|
||||
compile_fuzzer tar
|
||||
compile_fuzzer time
|
||||
#compile_fuzzer url
|
||||
compile_fuzzer xml
|
||||
compile_fuzzer zip
|
||||
compile_fuzzer zlib
|
||||
|
||||
compile_fuzzer $GOPATH/src/github.com/dvyukov/go-fuzz-corpus/asn1
|
||||
#compile_fuzzer $GOPATH/src/github.com/dvyukov/go-fuzz-corpus/bzip2
|
||||
compile_fuzzer $GOPATH/src/github.com/dvyukov/go-fuzz-corpus/csv
|
||||
compile_fuzzer $GOPATH/src/github.com/dvyukov/go-fuzz-corpus/elliptic
|
||||
compile_fuzzer $GOPATH/src/github.com/dvyukov/go-fuzz-corpus/flate
|
||||
compile_fuzzer $GOPATH/src/github.com/dvyukov/go-fuzz-corpus/fmt
|
||||
#compile_fuzzer $GOPATH/src/github.com/dvyukov/go-fuzz-corpus/gif
|
||||
compile_fuzzer $GOPATH/src/github.com/dvyukov/go-fuzz-corpus/gzip
|
||||
compile_fuzzer $GOPATH/src/github.com/dvyukov/go-fuzz-corpus/httpreq
|
||||
compile_fuzzer $GOPATH/src/github.com/dvyukov/go-fuzz-corpus/httpresp
|
||||
compile_fuzzer $GOPATH/src/github.com/dvyukov/go-fuzz-corpus/jpeg
|
||||
compile_fuzzer $GOPATH/src/github.com/dvyukov/go-fuzz-corpus/json
|
||||
compile_fuzzer $GOPATH/src/github.com/dvyukov/go-fuzz-corpus/lzw
|
||||
compile_fuzzer $GOPATH/src/github.com/dvyukov/go-fuzz-corpus/mime
|
||||
compile_fuzzer $GOPATH/src/github.com/dvyukov/go-fuzz-corpus/multipart
|
||||
compile_fuzzer $GOPATH/src/github.com/dvyukov/go-fuzz-corpus/png
|
||||
compile_fuzzer $GOPATH/src/github.com/dvyukov/go-fuzz-corpus/tar
|
||||
compile_fuzzer $GOPATH/src/github.com/dvyukov/go-fuzz-corpus/time
|
||||
#compile_fuzzer $GOPATH/src/github.com/dvyukov/go-fuzz-corpus/url
|
||||
compile_fuzzer $GOPATH/src/github.com/dvyukov/go-fuzz-corpus/xml
|
||||
compile_fuzzer $GOPATH/src/github.com/dvyukov/go-fuzz-corpus/zip
|
||||
compile_fuzzer $GOPATH/src/github.com/dvyukov/go-fuzz-corpus/zlib
|
||||
|
|
Loading…
Reference in New Issue