Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Link libgit2 via LIB_FUZZING_ENGINE #465

Merged
merged 1 commit into from
Nov 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
build: Link libgit2 via LIB_FUZZING_ENGINE
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
Paulo Gomes committed Nov 25, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit cdbbca0fb06b9179334f21f355d9103df85ab2eb
6 changes: 5 additions & 1 deletion tests/fuzz/oss_fuzz_postbuild.sh
Original file line number Diff line number Diff line change
@@ -20,10 +20,14 @@ set -euxo pipefail
# Use it for unsetting any environment variables that may impact other building
# processes.

if [[ -n "${PRE_LIB_FUZZING_ENGINE}" ]]; then
export LIB_FUZZING_ENGINE="${PRE_LIB_FUZZING_ENGINE}"
fi

unset TARGET_DIR
unset CGO_ENABLED
unset LIBRARY_PATH
unset PKG_CONFIG_PATH
unset CGO_CFLAGS
unset CGO_LDFLAGS
unset ADDITIONAL_LIBS
unset PRE_LIB_FUZZING_ENGINE
13 changes: 12 additions & 1 deletion tests/fuzz/oss_fuzz_prebuild.sh
Original file line number Diff line number Diff line change
@@ -70,4 +70,15 @@ else
curl -s --fail https://raw.githubusercontent.com/fluxcd/image-reflector-controller/${REFLECTOR_VER}/config/crd/bases/image.toolkit.fluxcd.io_imagepolicies.yaml -o controllers/testdata/crd/imagepolicies.yaml
fi

export ADDITIONAL_LIBS="${TARGET_DIR}/lib/libgit2.a"
# Temporary hack whilst libgit2 is still in use.
# Enables the fuzzing compilation to link libgit2.
#
# After building the fuzzers, the value of
# LIB_FUZZING_ENGINE is reset to what it was before
# it to avoid side effects onto other repositories.
#
# For context refer to:
# https://github.com/google/oss-fuzz/pull/9063
export PRE_LIB_FUZZING_ENGINE="${LIB_FUZZING_ENGINE}"

export LIB_FUZZING_ENGINE="${LIB_FUZZING_ENGINE} -Wl,--start-group ${TARGET_DIR}/lib/libgit2.a"