Skip to content

Commit

Permalink
oss-fuzz: clean up i386 build
Browse files Browse the repository at this point in the history
  • Loading branch information
randy408 committed Oct 24, 2019
1 parent 8d2fe82 commit 5f54c08
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 32 deletions.
16 changes: 0 additions & 16 deletions tests/cross_oss_fuzz.txt

This file was deleted.

32 changes: 16 additions & 16 deletions tests/build.sh → tests/ossfuzz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,31 @@
# This script is meant to be run by
# https://github.com/google/oss-fuzz/blob/master/projects/libspng/Dockerfile

if [ "$ARCHITECTURE" = 'i386' ]; then
wget http://ftp.us.debian.org/debian/pool/main/z/zlib/zlib1g-dev_1.2.11.dfsg-1_i386.deb http://ftp.us.debian.org/debian/pool/main/z/zlib/zlib1g_1.2.11.dfsg-1_i386.deb
ln -s /usr/lib/i386-linux-gnu/libz.a $SRC/libspng/libz.a
else
wget http://ftp.us.debian.org/debian/pool/main/z/zlib/zlib1g-dev_1.2.11.dfsg-1_amd64.deb http://ftp.us.debian.org/debian/pool/main/z/zlib/zlib1g_1.2.11.dfsg-1_amd64.deb
ln -s /usr/lib/x86_64-linux-gnu/libz.a $SRC/libspng/libz.a
fi

dpkg -i zlib*.deb

meson --default-library=static --buildtype=plain -Dstatic_zlib=true build

ninja -C build
wget http://www.zlib.net/zlib-1.2.11.tar.gz
tar xzvf zlib-1.2.11.tar.gz
mkdir zlib-1.2.11/build
cd zlib-1.2.11/build
cmake ..
make -j$(nproc) install
cd ../..

mkdir build
cd build
cmake -DSPNG_STATIC=ON ..
make -j$(nproc)
cd ..

$CXX $CXXFLAGS -std=c++11 -I. \
$SRC/libspng/tests/spng_read_fuzzer.cc \
-o $OUT/spng_read_fuzzer \
$LIB_FUZZING_ENGINE $SRC/libspng/build/libspng.a $SRC/libspng/libz.a
$LIB_FUZZING_ENGINE $SRC/libspng/build/libspng_static.a $SRC/libspng/zlib-1.2.11/build/libz.a

$CXX $CXXFLAGS -std=c++11 -I. \
$SRC/libspng/tests/spng_read_fuzzer.cc \
-o $OUT/spng_read_fuzzer_structure_aware \
-include ../fuzzer-test-suite/libpng-1.2.56/png_mutator.h \
-include $SRC/fuzzer-test-suite/libpng-1.2.56/png_mutator.h \
-D PNG_MUTATOR_DEFINE_LIBFUZZER_CUSTOM_MUTATOR \
$LIB_FUZZING_ENGINE $SRC/libspng/build/libspng.a $SRC/libspng/libz.a
$LIB_FUZZING_ENGINE $SRC/libspng/build/libspng_static.a $SRC/libspng/zlib-1.2.11/build/libz.a

find $SRC/libspng/tests/images -name "*.png" | \
xargs zip $OUT/spng_read_fuzzer_seed_corpus.zip
Expand Down

0 comments on commit 5f54c08

Please sign in to comment.