Merge pull request #10822

d4cf18d tests: fix local AFL fuzz target build (selsta)

ACKs: plowsof*, tobtoht
This commit is contained in:
tobtoht
2026-07-01 18:15:42 +00:00
2 changed files with 7 additions and 5 deletions
+2 -2
View File
@@ -102,7 +102,7 @@ coverage:
fuzz:
mkdir -p $(builddir)/fuzz
cd $(builddir)/fuzz && cmake -D STATIC=ON -D SANITIZE=ON -D BUILD_TESTS=ON -D USE_LTO=OFF -D CMAKE_C_COMPILER=afl-gcc -D CMAKE_CXX_COMPILER=afl-g++ -D ARCH="x86-64" -D CMAKE_BUILD_TYPE=fuzz -D BUILD_TAG="linux-x64" $(topdir) && $(MAKE)
cd $(builddir)/fuzz && cmake -D STATIC=ON -D SANITIZE=ON -D BUILD_TESTS=ON -D USE_LTO=OFF -D CMAKE_C_COMPILER=afl-gcc -D CMAKE_CXX_COMPILER=afl-g++ -D ARCH="x86-64" -D CMAKE_BUILD_TYPE=fuzz -D BUILD_TAG="linux-x64" $(topdir) && $(MAKE) -C tests/fuzz
clean:
@echo "WARNING: Back-up your wallet if it exists within ./"$(deldirs)"!" ; \
@@ -116,4 +116,4 @@ clean-all:
[ $$CONTINUE = "y" ] || [ $$CONTINUE = "Y" ] || (echo "Exiting."; exit 1;)
rm -rf ./build
.PHONY: all cmake-debug debug debug-test debug-test-asan debug-asan debug-all cmake-release release release-test release-all clean
.PHONY: all cmake-debug debug debug-test debug-test-asan debug-asan debug-all cmake-release release release-test release-all fuzz clean
+5 -3
View File
@@ -35,8 +35,8 @@
#ifndef OSSFUZZ
#if (!defined(__clang__) || (__clang__ < 5))
static int __AFL_LOOP(int)
#ifndef __AFL_LOOP
static int monero_fuzz_loop(int)
{
static int once = 0;
if (once)
@@ -44,6 +44,8 @@ static int __AFL_LOOP(int)
once = 1;
return 1;
}
#else
#define monero_fuzz_loop(n) __AFL_LOOP(n)
#endif
int run_fuzzer(int argc, const char **argv, Fuzzer &fuzzer)
@@ -65,7 +67,7 @@ int run_fuzzer(int argc, const char **argv, Fuzzer &fuzzer)
return ret;
const std::string filename = argv[1];
while (__AFL_LOOP(1000))
while (monero_fuzz_loop(1000))
{
ret = fuzzer.run(filename);
if (ret)