Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pillow] Fixes #3175

Merged
merged 1 commit into from
Jan 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion projects/pillow/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
FROM gcr.io/oss-fuzz-base/base-builder
MAINTAINER guidovranken@gmail.com
RUN apt-get update && apt-get install -y make autoconf automake build-essential libbz2-dev libc6-dev libffi-dev libfreetype6-dev libgdbm-dev libjpeg-turbo8-dev liblcms2-dev libncursesw5-dev libreadline-dev libsqlite3-dev libssl-dev libtiff5-dev libtool libwebp-dev make python python-dev python-setuptools tk-dev wget zlib1g-dev
RUN wget https://github.com/python/cpython/archive/v3.8.0b2.tar.gz
RUN wget https://github.com/python/cpython/archive/v3.8.1.tar.gz
RUN git clone --depth 1 https://github.com/python-pillow/Pillow.git pillow
RUN git clone --depth 1 https://github.com/guidovranken/oss-fuzz-fuzzers
WORKDIR pillow
Expand Down
14 changes: 7 additions & 7 deletions projects/pillow/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
# Because the virtualenv will inherit CC and CFLAGS of the instrumented CPython, and that will fail.

cd $SRC/
tar zxf v3.8.0b2.tar.gz
cd cpython-3.8.0b2/
tar zxf v3.8.1.tar.gz
cd cpython-3.8.1/

# Ignore memory leaks from python scripts invoked in the build
export ASAN_OPTIONS="detect_leaks=0"
Expand Down Expand Up @@ -65,17 +65,17 @@ rm -rf $CPYTHON_UNINSTRUMENTED_INSTALL_PATH
mkdir $CPYTHON_UNINSTRUMENTED_INSTALL_PATH

cd $SRC/
tar zxf v3.8.0b2.tar.gz
tar zxf v3.8.1.tar.gz

# Compile uninstrumented CPython
cp -R $SRC/cpython-3.8.0b2/ $SRC/cpython-3.8.0b2-uninstrumented
cd $SRC/cpython-3.8.0b2-uninstrumented
cp -R $SRC/cpython-3.8.1/ $SRC/cpython-3.8.1-uninstrumented
cd $SRC/cpython-3.8.1-uninstrumented
CFLAGS="" CXXFLAGS="" ./configure --prefix=$CPYTHON_UNINSTRUMENTED_INSTALL_PATH
CFLAGS="" CXXFLAGS="" make -j$(nproc)
CFLAGS="" CXXFLAGS="" make install

# Compile instrumented CPython
cd $SRC/cpython-3.8.0b2/
cd $SRC/cpython-3.8.1/
cp $SRC/oss-fuzz-fuzzers/pillow/python_coverage.h Python/

# Patch the interpreter to record code coverage
Expand All @@ -102,8 +102,8 @@ cd $SRC/pillow
CFLAGS="" CXXFLAGS="" ./setup.py build_ext --inplace >build.sh
grep "^\(gcc\|x86_64-linux-gnu-gcc\|clang\) " build.sh | sed 's/^\(gcc\|x86_64-linux-gnu-gcc\|clang\) /$CC $CFLAGS /g' | sed 's/-DPILLOW_VERSION="\([^"]\+\)"/-DPILLOW_VERSION="\\"\1\\""/g' >build2.sh
bash build2.sh
find
cp -R $SRC/pillow $OUT/
cp /usr/lib/x86_64-linux-gnu/libjpeg.so.8 $OUT/
cp /usr/lib/x86_64-linux-gnu/libtiff.so.5 $OUT/
cp /usr/lib/x86_64-linux-gnu/libjbig.so.0 $OUT/
cp $SRC/oss-fuzz-fuzzers/pillow/corpus.zip $OUT/fuzzer-loadimg_seed_corpus.zip
2 changes: 2 additions & 0 deletions projects/pillow/project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ sanitizers:
- undefined
architectures:
- x86_64
fuzzing_engines:
- libfuzzer