Skip to content

Commit d7b4cdf

Browse files
committed
Add instructions for building an instrumented libonig
[ci skip]
1 parent 1fc2fec commit d7b4cdf

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

sapi/fuzzer/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,20 @@ mkdir ./my-parser-corpus
4848
sapi/fuzzer/php-fuzz-parser -merge=1 ./my-parser-corpus sapi/fuzzer/corpus/parser
4949
sapi/fuzzer/php-fuzz-parser -only_ascii=1 ./my-parser-corpus
5050
```
51+
52+
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.
53+
54+
```sh
55+
mkdir libonig
56+
pushd libonig
57+
wget -O - https://github.com/kkos/oniguruma/releases/download/v6.9.3/onig-6.9.3.tar.gz \
58+
| tar -xz --strip-components=1
59+
./configure CC=clang CFLAGS="-fsanitize=fuzzer-no-link,address -O2 -g"
60+
make
61+
popd
62+
63+
export ONIG_CFLAGS="-I$PWD/libonig/src"
64+
export ONIG_LIBS="-L$PWD/libonig/src/.libs -l:libonig.a"
65+
```
66+
67+
This will link an instrumented libonig statically into the PHP binary.

0 commit comments

Comments
 (0)