summaryrefslogtreecommitdiff
path: root/test/ossfuzz.sh
blob: 49e721c9f97b175d658120b6e01f2d7271117510 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# This script is meant to be run by
# https://github.com/google/oss-fuzz/blob/master/projects/libspectre/Dockerfile

cd ghostscript
./configure
make -j$(nproc) soinstall
make -j$(nproc) libgs
cd ..
rm /usr/local/lib/libgs.so*
cp ghostscript/bin/gs.a /usr/local/lib/libgs.a

./autogen.sh --enable-static --disable-shared
make -j$(nproc)

$CXX $CXXFLAGS $SRC/libspectre/test/spectre_read_fuzzer.c -I. \
    -o $OUT/spectre_read_fuzzer \
    $LIB_FUZZING_ENGINE $SRC/libspectre/libspectre/.libs/libspectre.a \
    $SRC/libspectre/ghostscript/bin/gs.a

find $SRC/libspectre/ghostscript -name "*.ps" | \
     xargs zip $OUT/spectre_read_fuzzer_seed_corpus.zip

cp $SRC/libspectre/test/postscript.dict $OUT/spectre_read_fuzzer.dict

# Needed for coverage builds
cd ghostscript/obj

ln -s ../jpeg/jdapistd.c jdapistd.c
ln -s ../jpeg/jdarith.c jdarith.c
ln -s ../jpeg/jdcoefct.c jdcoefct.c
ln -s ../jpeg/jdcolor.c jdcolor.c
ln -s ../jpeg/jddctmgr.c jddctmgr.c
ln -s ../jpeg/jdhuff.c jdhuff.c
ln -s ../jpeg/jdinput.c jdinput.c
ln -s ../jpeg/jdmainct.c jdmainct.c
ln -s ../jpeg/jdmarker.c jdmarker.c
ln -s ../jpeg/jdmaster.c jdmaster.c
ln -s ../jpeg/jdpostct.c jdpostct.c
ln -s ../jpeg/jdsample.c jdsample.c
ln -s ../jpeg/jerror.c jerror.c
ln -s ../jpeg/jcsample.c jcsample.c
ln -s ../jpeg/jidctint.c jidctint.c
ln -s ../jpeg/jcarith.c jcarith.c
ln -s ../jpeg/jmemmgr.c jmemmgr.c
ln -s ../jpeg/jcdctmgr.c jcdctmgr.c
ln -s ../jpeg/jcinit.c jcinit.c
ln -s ../jpeg/jutils.c jutils.c
ln -s ../jpeg/jcmaster.c jcmaster.c
ln -s ../jpeg/jcparam.c jcparam.c
ln -s ../jpeg/jfdctint.c jfdctint.c
ln -s ../jpeg/jcapistd.c jcapistd.c
ln -s ../jpeg/jccoefct.c jccoefct.c
ln -s ../jpeg/jchuff.c jchuff.c
ln -s ../jpeg/jcmarker.c jcmarker.c
ln -s ../jpeg/jcomapi.c jcomapi.c
ln -s ../jpeg/jdapimin.c jdapimin.c
ln -s ../jpeg/jcapimin.c jcapimin.c
ln -s ../jpeg/jccolor.c jccolor.c
ln -s ../jpeg/jcprepct.c jcprepct.c
ln -s ../jpeg/jcmainct.c jcmainct.c

cd ../..