mirror of https://github.com/google/oss-fuzz.git
Add mbstring fuzzer for PHP (#2233)
This commit is contained in:
parent
c879a0cf3e
commit
a51f446e14
|
@ -17,10 +17,11 @@
|
|||
FROM gcr.io/oss-fuzz-base/base-builder
|
||||
MAINTAINER stas@php.net
|
||||
RUN apt-get update && apt-get install -y make autoconf automake libtool bison re2c make ca-certificates curl \
|
||||
xz-utils dpkg-dev file libc-dev pkg-config libcurl4-openssl-dev libedit-dev libsqlite3-dev libssl-dev zlib1g-dev
|
||||
xz-utils dpkg-dev file libc-dev pkg-config libcurl4-openssl-dev libedit-dev libsqlite3-dev libssl-dev \
|
||||
zlib1g-dev libonig-dev chrpath
|
||||
RUN git clone --depth 1 --branch master https://github.com/php/php-src.git php-src
|
||||
RUN git clone --depth 1 https://github.com/smalyshev/php-fuzzing-sapi.git php-src/sapi/fuzzer
|
||||
WORKDIR php-src
|
||||
COPY build.sh $SRC/
|
||||
COPY build.sh *.options $SRC/
|
||||
# This ideally will be gone eventually, right now used for more flexibility in tweaking Makefile options
|
||||
# COPY Makefile.frag $SRC/php-src/sapi/fuzzer
|
||||
|
|
|
@ -15,15 +15,26 @@
|
|||
#
|
||||
################################################################################
|
||||
|
||||
mkdir -p $OUT/lib/
|
||||
cp sapi/fuzzer/json.dict $OUT/php-fuzz-json.dict
|
||||
cp /usr/lib/x86_64-linux-gnu/libonig.so.2 $OUT/lib/
|
||||
# build project
|
||||
./buildconf
|
||||
./configure --enable-fuzzer --enable-option-checking=fatal --disable-libxml --disable-dom \
|
||||
--disable-simplexml --disable-xml --disable-xmlreader --disable-xmlwriter --without-pear \
|
||||
--enable-exif --disable-phpdbg --disable-cgi
|
||||
--enable-exif --disable-phpdbg --disable-cgi --enable-mbstring
|
||||
make
|
||||
cp sapi/fuzzer/json.dict $OUT/php-fuzz-json.dict
|
||||
cp sapi/fuzzer/php-fuzz-json $OUT/
|
||||
cp sapi/fuzzer/php-fuzz-exif $OUT/
|
||||
|
||||
FUZZERS="php-fuzz-json php-fuzz-exif php-fuzz-mbstring"
|
||||
for fuzzerName in $FUZZERS; do
|
||||
cp sapi/fuzzer/$fuzzerName $OUT/
|
||||
# for loading missing libs like libonig
|
||||
chrpath -r '$ORIGIN/lib' $OUT/$fuzzerName
|
||||
# copy runtime options
|
||||
cp $SRC/runtime.options $OUT/${fuzzerName}.options
|
||||
done
|
||||
# copy corpora from source
|
||||
for fuzzerName in `ls sapi/fuzzer/corpus`; do
|
||||
zip -j $OUT/php-fuzz-${fuzzerName}_seed_corpus.zip sapi/fuzzer/corpus/${fuzzerName}/*
|
||||
done
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
[libfuzzer]
|
||||
detect_leaks=0
|
Loading…
Reference in New Issue