diff --git a/projects/gitoxide/Dockerfile b/projects/gitoxide/Dockerfile new file mode 100644 index 000000000..4fecba5f5 --- /dev/null +++ b/projects/gitoxide/Dockerfile @@ -0,0 +1,20 @@ +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +FROM gcr.io/oss-fuzz-base/base-builder-rust +RUN git clone --depth 1 https://github.com/Byron/gitoxide.git gitoxide +WORKDIR gitoxide +COPY build.sh $SRC/ diff --git a/projects/gitoxide/build.sh b/projects/gitoxide/build.sh new file mode 100755 index 000000000..5794b072f --- /dev/null +++ b/projects/gitoxide/build.sh @@ -0,0 +1,42 @@ +#!/bin/bash -eu +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +set -eox pipefail + +# TODO: Switch back to this method for fuzzer discovery once all the fuzzers +# build successfully. +# FUZZ_CRATES=$(find . -type d -name fuzz -exec readlink -f {} \;) + +FUZZ_CRATE_DIRS=("$(pwd)/git-config"\ + "$(pwd)/git-pathspec"\ + "$(pwd)/git-refspec"\ + "$(pwd)/git-revision") + + +for CRATE_DIR in ${FUZZ_CRATE_DIRS[@]}; +do + echo "Building crate: $CRATE_DIR" + cd $CRATE_DIR + cargo +nightly fuzz build -O --debug-assertions + FUZZ_TARGET_OUTPUT_DIR=fuzz/target/x86_64-unknown-linux-gnu/release + for f in fuzz/fuzz_targets/*.rs + do + FUZZ_TARGET_NAME=$(basename ${f%.*}) + CRATE_NAME=$(basename $CRATE_DIR) + cp $FUZZ_TARGET_OUTPUT_DIR/$FUZZ_TARGET_NAME $OUT/$CRATE_NAME-$FUZZ_TARGET_NAME + done +done \ No newline at end of file diff --git a/projects/gitoxide/project.yaml b/projects/gitoxide/project.yaml new file mode 100644 index 000000000..b65dccc90 --- /dev/null +++ b/projects/gitoxide/project.yaml @@ -0,0 +1,9 @@ +homepage: "https://crates.io/crates/gitoxide" +language: rust +primary_contact: "byronimo@gmail.com" +main_repo: "https://github.com/Byron/gitoxide" +file_github_issue: true +sanitizers: + - address +fuzzing_engines: + - libfuzzer