2019-07-27 19:44:18 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
|
|
|
PROJECT_NAME=libsndfile
|
|
|
|
|
|
|
|
# Clone the oss-fuzz repository
|
|
|
|
git clone https://github.com/google/oss-fuzz.git /tmp/ossfuzz
|
|
|
|
|
|
|
|
if [[ ! -d /tmp/ossfuzz/projects/${PROJECT_NAME} ]]
|
|
|
|
then
|
|
|
|
echo "Could not find the ${PROJECT_NAME} project in ossfuzz"
|
|
|
|
|
|
|
|
# Exit with a success code while the libsndfile project is not expected to exist
|
|
|
|
# on oss-fuzz.
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2020-09-01 22:25:04 +00:00
|
|
|
# Work out which branch to clone from, inside Docker
|
|
|
|
BRANCH=${GITHUB_REF}
|
2019-07-27 19:44:18 +00:00
|
|
|
|
2020-09-01 22:25:04 +00:00
|
|
|
# Modify the oss-fuzz Dockerfile so that we're checking out the current reference on CI.
|
2020-10-15 14:56:49 +00:00
|
|
|
sed -i "s@RUN.*@RUN git config --global remote.origin.fetch '+refs/pull/*:refs/remotes/origin/pull/*' \&\& git clone https://github.com/libsndfile/libsndfile.git /src/libsndfile \&\& cd /src/libsndfile \&\& git checkout -b ${BRANCH}@" /tmp/ossfuzz/projects/${PROJECT_NAME}/Dockerfile
|
2019-07-27 19:44:18 +00:00
|
|
|
|
|
|
|
# Try and build the fuzzers
|
|
|
|
pushd /tmp/ossfuzz
|
2020-12-07 15:03:42 +00:00
|
|
|
python3 infra/helper.py build_image --pull ${PROJECT_NAME}
|
|
|
|
python3 infra/helper.py build_fuzzers ${PROJECT_NAME}
|
|
|
|
python3 infra/helper.py check_build ${PROJECT_NAME} --engine libfuzzer --sanitizer address --architecture x86_64
|
2019-07-27 19:44:18 +00:00
|
|
|
popd
|