diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-09-13 06:28:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-12 21:28:04 -0700 |
commit | 3b1124b6eab29f266d0169c77a9f9e3a80ef8555 (patch) | |
tree | 06a5678cd6bbd31b20dcfeba3f6dfe6cc78b4356 /projects/bitcoin-core | |
parent | d59c8adb4f413c59d028c239d7729084b204b1d8 (diff) | |
download | oss-fuzz-3b1124b6eab29f266d0169c77a9f9e3a80ef8555.tar.gz |
bitcoin-core: Fix build hack to work with clang-14 (#6426)
Diffstat (limited to 'projects/bitcoin-core')
-rwxr-xr-x | projects/bitcoin-core/build.sh | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/projects/bitcoin-core/build.sh b/projects/bitcoin-core/build.sh index c2b9f17a1..605df8d48 100755 --- a/projects/bitcoin-core/build.sh +++ b/projects/bitcoin-core/build.sh @@ -65,9 +65,16 @@ if [ -n "${OSS_FUZZ_CI-}" ]; then FUZZ_TARGETS=( ${FUZZ_TARGETS[@]:0:2} ) fi -# Compile the fuzz executable again with a "magic string" as the name of the fuzz target +# OSS-Fuzz requires a separate and self-contained binary for each fuzz target. +# To inject the fuzz target name in the finished binary, compile the fuzz +# executable with a "magic string" as the name of the fuzz target. +# +# An alternative to mocking the string in the finished binary would be to +# replace the string in the source code and re-invoke 'make'. This is slower, +# so use the hack. export MAGIC_STR="b5813eee2abc9d3358151f298b75a72264ffa119d2f71ae7fefa15c4b70b4bc5b38e87e3107a730f25891ea428b2b4fabe7a84f5bfa73c79e0479e085e4ff157" -sed -i "s|std::getenv(\"FUZZ\")|\"$MAGIC_STR\"|g" "./src/test/fuzz/fuzz.cpp" +sed -i "s|.*std::getenv(\"FUZZ\").*|std::string fuzz_target{\"$MAGIC_STR\"};|g" "./src/test/fuzz/fuzz.cpp" +sed -i "s|.find(fuzz_target)|.find(fuzz_target.c_str())|g" "./src/test/fuzz/fuzz.cpp" make -j$(nproc) # Replace the magic string with the actual name of each fuzz target |