gitoxide: initial integration (#9529)

Signed-off-by: Nathaniel Brough <nathaniel.brough@gmail.com>

---------

Signed-off-by: Nathaniel Brough <nathaniel.brough@gmail.com>
Co-authored-by: jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com>
This commit is contained in:
Nathaniel Brough 2023-01-30 17:49:17 -08:00 committed by GitHub
parent 4ebd017e8e
commit e7c0e59a32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 71 additions and 0 deletions

View File

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

42
projects/gitoxide/build.sh Executable file
View File

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

View File

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