aboutsummaryrefslogtreecommitdiffhomepage
path: root/projects/php
diff options
context:
space:
mode:
authorGravatar Stanislav Malyshev <smalyshev@users.noreply.github.com>2019-03-05 07:12:32 -0800
committerGravatar Max Moroz <dor3s1@gmail.com>2019-03-05 07:12:32 -0800
commitb7e17966a87a83f783fb3cb750fc8128cafe7a53 (patch)
treec6e87aabb75e672bc9da4ba1d1529c18473dff1c /projects/php
parentda89846a2199017355537a972119c38c7ea1c93b (diff)
[php] Add files to run php fuzz (#2202)
So far only one fuzzer active - json one. More to come.
Diffstat (limited to 'projects/php')
-rw-r--r--projects/php/Dockerfile26
-rwxr-xr-xprojects/php/build.sh28
-rw-r--r--projects/php/project.yaml5
3 files changed, 59 insertions, 0 deletions
diff --git a/projects/php/Dockerfile b/projects/php/Dockerfile
new file mode 100644
index 00000000..1464cb8f
--- /dev/null
+++ b/projects/php/Dockerfile
@@ -0,0 +1,26 @@
+# Copyright 2019 Google Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+################################################################################
+
+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
+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/
+# This ideally will be gone eventually, right now used for more flexibility in tweaking Makefile options
+# COPY Makefile.frag $SRC/php-src/sapi/fuzzer
diff --git a/projects/php/build.sh b/projects/php/build.sh
new file mode 100755
index 00000000..cf371d51
--- /dev/null
+++ b/projects/php/build.sh
@@ -0,0 +1,28 @@
+#!/bin/bash -eu
+# Copyright 2019 Google Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+################################################################################
+
+# 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
+make
+cp sapi/fuzzer/json.dict $OUT/php-fuzz-json.dict
+cp sapi/fuzzer/php-fuzz-json $OUT/
+for fuzzerName in `ls sapi/fuzzer/corpus`; do
+ zip -j $OUT/php-fuzz-${fuzzerName}_seed_corpus.zip sapi/fuzzer/corpus/${fuzzerName}/*
+done \ No newline at end of file
diff --git a/projects/php/project.yaml b/projects/php/project.yaml
new file mode 100644
index 00000000..5b0900a6
--- /dev/null
+++ b/projects/php/project.yaml
@@ -0,0 +1,5 @@
+homepage: "http://php.net/"
+primary_contact: "stas@php.net"
+auto_ccs:
+ - "smalyshev@gmail.com"
+experimental: True