aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README-maintainer5
-rwxr-xr-xbuild-scripts/build-fuzzer10
-rwxr-xr-xfuzz/oss-fuzz-build18
3 files changed, 14 insertions, 19 deletions
diff --git a/README-maintainer b/README-maintainer
index 5293e5ad..9b5e4a89 100644
--- a/README-maintainer
+++ b/README-maintainer
@@ -80,11 +80,8 @@ GOOGLE OSS-FUZZ
Clone the oss-fuzz project. From the root directory of the repository:
- Add `-e GITHUB_FORK=fork -e GITHUB_BRANCH=branch` to build_fuzzers
- from a qpdf fork/branch rather than qpdf/main.
-
python3 infra/helper.py build_image --pull qpdf
- python3 infra/helper.py build_fuzzers [ --sanitizer memory|undefined|address ] qpdf
+ python3 infra/helper.py build_fuzzers [ --sanitizer memory|undefined|address ] qpdf [path-to-qpdf-source]
python3 infra/helper.py check_build qpdf
python3 infra/helper.py build_fuzzers --sanitizer coverage qpdf
python3 infra/helper.py coverage qpdf
diff --git a/build-scripts/build-fuzzer b/build-scripts/build-fuzzer
index 00c1c8ac..d713c09c 100755
--- a/build-scripts/build-fuzzer
+++ b/build-scripts/build-fuzzer
@@ -4,8 +4,12 @@ export WORK=$PWD/work
export OUT=$PWD/out
mkdir -p $WORK $OUT
sudo apt-get update
-sudo apt-get -y install \
- autoconf build-essential zlib1g-dev libjpeg-dev
+sudo apt-get -y install build-essential cmake zlib1g-dev libjpeg-dev
./fuzz/oss-fuzz-build
-ls -l out/qpdf*fuzzer
+ls -l out/qpdf_fuzzer
ls -l out/
+if ldd out/qpdf_fuzzer | egrep 'libjpeg|libz|libqpdf'; then
+ echo 1>&2 "*** Fuzzers linked dynamically with some dependent libraries."
+ ldd out/qpdf_fuzzer
+ exit 2
+fi
diff --git a/fuzz/oss-fuzz-build b/fuzz/oss-fuzz-build
index a875edcf..ae03292e 100755
--- a/fuzz/oss-fuzz-build
+++ b/fuzz/oss-fuzz-build
@@ -21,15 +21,9 @@ if [[ $GITHUB_FORK != "" ]]; then
fi
fi
-./configure \
- --enable-oss-fuzz \
- --enable-static \
- --disable-shared \
- --enable-crypto-native \
- --disable-implicit-crypto \
- --prefix="$WORK" \
- LDFLAGS="-L$WORK/lib" \
- CPPFLAGS="-I$WORK/include" \
- LIBS="-pthread"
-make -j$(nproc) install
-make install_fuzz
+env CMAKE_PREFIX_PATH=$WORK LDFLAGS="-L$WORK/lib -lpthread" \
+ cmake -S . -B build \
+ -DOSS_FUZZ=1 -DBUILD_SHARED_LIBS=0 -DCMAKE_BUILD_TYPE=Debug \
+ -DUSE_IMPLICIT_CRYPTO=0 -DREQUIRE_CRYPTO_NATIVE=1
+cmake --build build -j$(nproc) --target fuzzers
+cmake --install build --component fuzz