mirror of https://github.com/google/oss-fuzz.git
pillow: initial integration (#4754)
* pillow: initial integration, but draft for now since some aspects of Python fuzzing are unclear. * pillow: add header. * Added pillow project. * pillow: simply build. * pillow: update project.yaml and build. * pillow: remove or true when makeing. * Pillow: remove use of temp file and simplify other aspects. * pillow: do not use warnings and only use embedded jpeg in first run. * pillow: speed gains.
This commit is contained in:
parent
3c4c0fe6dd
commit
8254336e4d
|
@ -0,0 +1,22 @@
|
|||
# Copyright 2020 Google LLC
|
||||
#
|
||||
# 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
|
||||
RUN apt-get install -y libjpeg-dev zlib1g-dev libpng-dev
|
||||
RUN git clone --depth 1 https://github.com/python-pillow/Pillow
|
||||
WORKDIR $SRC
|
||||
COPY build.sh $SRC/
|
||||
COPY fuzz_* $SRC/Pillow
|
|
@ -0,0 +1,47 @@
|
|||
#!/bin/bash -eu
|
||||
# Copyright 2020 Google LLC
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
################################################################################
|
||||
cd Pillow
|
||||
make install-req
|
||||
python3 setup.py develop
|
||||
|
||||
bp="$(find ./build -name '_imagingtk.o')"
|
||||
BUILD_DIR="${bp/_imagingtk.o/}"
|
||||
rm ${BUILD_DIR}/_imagingmath.o
|
||||
rm ${BUILD_DIR}/_imagingtk.o
|
||||
rm ${BUILD_DIR}/_imagingmorph.o
|
||||
|
||||
TS="$(find ./src/PIL/ -name '_imaging.*.so')"
|
||||
$CXX -pthread -shared $CXXFLAGS $LIB_FUZZING_ENGINE ${BUILD_DIR}/*.o ${BUILD_DIR}/libImaging/*.o \
|
||||
-L/usr/local/lib -L/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu \
|
||||
-L/usr/lib/x86_64-linux-gnu/libfakeroot -L/usr/lib -L/lib \
|
||||
-L/usr/local/lib -ljpeg -lz \
|
||||
-o ${TS} -stdlib=libc++
|
||||
|
||||
# Build fuzzers in $OUT.
|
||||
for fuzzer in $(find $SRC -name 'fuzz_*.py'); do
|
||||
fuzzer_basename=$(basename -s .py $fuzzer)
|
||||
fuzzer_package=${fuzzer_basename}.pkg
|
||||
pyinstaller --distpath $OUT --onefile --name $fuzzer_package $fuzzer
|
||||
|
||||
# Create execution wrapper.
|
||||
echo "#!/bin/sh
|
||||
# LLVMFuzzerTestOneInput for fuzzer detection.
|
||||
LD_PRELOAD=\$(dirname "\$0")/libclang_rt.asan-x86_64.so \
|
||||
ASAN_OPTIONS=\$ASAN_OPTIONS:symbolize=1:detect_leaks=0 \
|
||||
\$(dirname "\$0")/$fuzzer_package \$@" > $OUT/$fuzzer_basename
|
||||
chmod u+x $OUT/$fuzzer_basename
|
||||
done
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,10 @@
|
|||
homepage: "https://github.com/python-pillow/Pillow"
|
||||
language: python
|
||||
primary_contact: "security@python-pillow.org"
|
||||
auto_ccs:
|
||||
- "david@adalogics.com"
|
||||
fuzzing_engines:
|
||||
- libfuzzer
|
||||
sanitizers:
|
||||
- address
|
||||
- undefined
|
Loading…
Reference in New Issue