3 if [ -z "${OUT}" ] || [ -z "${SRC}" ] || [ -z "${WORK}" ]; then
4 echo "OUT, SRC or WORK not set - script expects to be called inside oss-fuzz build env"
8 #shuffle CXXFLAGS -stdlib=libc++ arg into CXX as well because we use
9 #the CXX as the linker and need to pass -stdlib=libc++ to build
10 export CXX
="$CXX -stdlib=libc++"
11 #similarly force the -fsanitize etc args in as well as pthread to get
12 #things to link successfully during the build
13 export LDFLAGS
="$CFLAGS -lpthread"
16 $SRC/libreoffice
/autogen.sh
--with-distro=LibreOfficeOssFuzz
--with-external-tar=$SRC
18 #build-time rsc tool leaks a titch
19 export ASAN_OPTIONS
="detect_leaks=0"
23 #some minimal fonts required
24 cp $SRC/libreoffice
/extras
/source
/truetype
/symbol
/opens___.ttf instdir
/share
/fonts
/truetype
/Liberation
* $OUT
25 #minimal runtime requirements
26 rm -rf $OUT/services
$OUT/types
$OUT/*rdb
29 cp -r *fuzzer
*rc types.rdb types
$OUT
30 head -c -14 services.rdb
> $OUT/services.rdb
31 tail -c +85 .
/services
/services.rdb
>> $OUT/services.rdb
35 cp $SRC/*_seed_corpus.
zip $OUT
37 cp $SRC/gif.dict
$OUT/giffuzzer.dict
38 cp $SRC/jpeg.dict
$OUT/jpgfuzzer.dict
39 cp $SRC/png.dict
$OUT/pngfuzzer.dict
40 cp $SRC/tiff.dict
$OUT/tiffuzzer.dict
41 cp $SRC/xml.dict
$OUT/fodtfuzzer.dict
42 cp $SRC/xml.dict
$OUT/fodsfuzzer.dict
43 cp $SRC/xml.dict
$OUT/fodpfuzzer.dict
44 cp $SRC/xml.dict
$OUT/fodgfuzzer.dict