summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-09-18 11:53:15 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-09-18 12:49:42 +0200
commitd7b4cdff3f048ce232bd16870695ffbfcba45f4e (patch)
treede276607709c014f50b2ca143468ef9b7303ae06
parent1fc2fec1381d949dcaaafa590788d43e7a7a1e11 (diff)
downloadphp-git-d7b4cdff3f048ce232bd16870695ffbfcba45f4e.tar.gz
Add instructions for building an instrumented libonig
[ci skip]
-rw-r--r--sapi/fuzzer/README.md17
1 files changed, 17 insertions, 0 deletions
diff --git a/sapi/fuzzer/README.md b/sapi/fuzzer/README.md
index b07428f041..166be746ea 100644
--- a/sapi/fuzzer/README.md
+++ b/sapi/fuzzer/README.md
@@ -48,3 +48,20 @@ mkdir ./my-parser-corpus
sapi/fuzzer/php-fuzz-parser -merge=1 ./my-parser-corpus sapi/fuzzer/corpus/parser
sapi/fuzzer/php-fuzz-parser -only_ascii=1 ./my-parser-corpus
```
+
+For the mbstring fuzzer, you may want to build the libonig dependency with instrumentation. At this time, libonig is not clean under ubsan, so only the fuzzer and address sanitizers may be used.
+
+```sh
+mkdir libonig
+pushd libonig
+wget -O - https://github.com/kkos/oniguruma/releases/download/v6.9.3/onig-6.9.3.tar.gz \
+ | tar -xz --strip-components=1
+./configure CC=clang CFLAGS="-fsanitize=fuzzer-no-link,address -O2 -g"
+make
+popd
+
+export ONIG_CFLAGS="-I$PWD/libonig/src"
+export ONIG_LIBS="-L$PWD/libonig/src/.libs -l:libonig.a"
+```
+
+This will link an instrumented libonig statically into the PHP binary.