From 38b19534178219cd192c3ab938a806d0fb0bcb63 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Sat, 13 Feb 2021 19:27:13 +0000 Subject: [PATCH] [Pillow] Use upstream support for fuzzing build (#5193) * Don't worry about raqm/fonts for now. * Current fuzzer doesn't test the font handling * Upstream (pillow) changes are coming to packaging for raqm/harfbuzz/fribidi * Use core setup.py options for build linking explcitly copy libraries in pyinstaller --- projects/pillow/Dockerfile | 10 ++++------ projects/pillow/build.sh | 28 +++++++++++----------------- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/projects/pillow/Dockerfile b/projects/pillow/Dockerfile index 3f5a1176b..ab9089553 100644 --- a/projects/pillow/Dockerfile +++ b/projects/pillow/Dockerfile @@ -54,12 +54,10 @@ RUN cd Pillow && depends/install_extra_test_images.sh COPY build.sh $SRC/ -# pillow runtime dependencies +# pillow optional runtime dependencies RUN apt-get install -y \ - libfribidi-dev \ - libharfbuzz-dev \ - python3-tk \ - tcl8.6-dev \ - tk8.6-dev + python3-tk \ + tcl8.6-dev \ + tk8.6-dev WORKDIR $SRC/Pillow diff --git a/projects/pillow/build.sh b/projects/pillow/build.sh index c0f791dac..1d05bea79 100644 --- a/projects/pillow/build.sh +++ b/projects/pillow/build.sh @@ -17,27 +17,21 @@ python3 setup.py build --build-base=/tmp/build install -bp="$(find /tmp/build -name '_imaging.o')" -BUILD_DIR="${bp/_imaging.o/}" -if [ -d "$BUILD_DIR" ]; then - find $BUILD_DIR -name _imagingmath.o -delete - find $BUILD_DIR -name _imagingtk.o -delete - find $BUILD_DIR -name _imagingmorph.o -delete -fi; - -# Relink with fuzzing engine -TS="$(find /usr/local/lib/python3.* -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 -lxcb -lfreetype -lopenjp2 -ltiff -llcms2 -lwebp -lwebpmux -lwebpdemux \ - -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 + pyinstaller \ + --add-binary /usr/local/lib/libjpeg.so.9:. \ + --add-binary /usr/local/lib/libfreetype.so.6:. \ + --add-binary /usr/local/lib/liblcms2.so.2:. \ + --add-binary /usr/local/lib/libopenjp2.so.7:. \ + --add-binary /usr/local/lib/libpng16.so.16:. \ + --add-binary /usr/local/lib/libtiff.so.5:. \ + --add-binary /usr/local/lib/libwebp.so.7:. \ + --add-binary /usr/local/lib/libwebpdemux.so.2:. \ + --add-binary /usr/local/lib/libwebpmux.so.3:. \ + --distpath $OUT --onefile --name $fuzzer_package $fuzzer # Create execution wrapper. echo "#!/bin/sh