aboutsummaryrefslogtreecommitdiff
path: root/src/tests/fuzzing/README
diff options
context:
space:
mode:
authorArjun <pkillarjun@protonmail.com>2024-05-09 21:13:03 +0530
committerGreg Hudson <ghudson@mit.edu>2024-05-28 16:13:29 -0400
commitc3dccd348e3c557cbc34b3be0cbc13aff1bfa144 (patch)
treed7d69c8cb27860ad01406ebf352d57cb9a458aa6 /src/tests/fuzzing/README
parent4b21b2e2821d3cb91042be09e0ebe09707a57d72 (diff)
downloadkrb5-c3dccd348e3c557cbc34b3be0cbc13aff1bfa144.zip
krb5-c3dccd348e3c557cbc34b3be0cbc13aff1bfa144.tar.gz
krb5-c3dccd348e3c557cbc34b3be0cbc13aff1bfa144.tar.bz2
Add OSS-Fuzz targets and corpora
[ghudson@mit.edu: style adjustments] bigredbutton: whitespace
Diffstat (limited to 'src/tests/fuzzing/README')
-rw-r--r--src/tests/fuzzing/README26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/tests/fuzzing/README b/src/tests/fuzzing/README
new file mode 100644
index 0000000..d133824
--- /dev/null
+++ b/src/tests/fuzzing/README
@@ -0,0 +1,26 @@
+This directory builds fuzzing targets for oss-fuzz compatibility.
+ If you wish to build it locally, you can do so by using the given
+ guide below. Note that it only works on GNU/Linux.
+
+Export flags required for building fuzzing targets.
+```bash
+export CC=clang
+export CXX=clang++
+export CFLAGS="-g -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize=fuzzer-no-link"
+export CXXFLAGS="-g -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize=fuzzer-no-link"
+export LIB_FUZZING_ENGINE="-fsanitize=fuzzer"
+```
+
+Compilation of the fuzzing targets.
+```bash
+autoreconf
+./configure CFLAGS="-fcommon $CFLAGS" CXXFLAGS="-fcommon $CXXFLAGS" \
+ --enable-static --disable-shared --enable-ossfuzz
+make
+```
+
+Running fuzzing targets.
+```bash
+mkdir fuzz_${TARGET}_corpus
+./fuzz_${TARGET} fuzz_${TARGET}_corpus/ fuzz_${TARGET}_seed_corpus
+```