1#!/bin/bash -eu 2# Copyright 2018 Google Inc. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16################################################################################ 17 18cd ${SRC}/jbig2dec 19./autogen.sh 20make distclean 21 22mkdir -p ${WORK}/jbig2dec 23cd ${WORK}/jbig2dec 24${SRC}/jbig2dec/configure 25 26LDFLAGS="$CXXFLAGS" make -C ${WORK}/jbig2dec -j$(nproc) 27fuzz_target=jbig2_fuzzer 28 29$CXX $CXXFLAGS -std=c++11 -I$SRC/jbig2dec -fno-inline-functions \ 30 $SRC/jbig2_fuzzer.cc -o $OUT/$fuzz_target \ 31 $LIB_FUZZING_ENGINE ${WORK}/jbig2dec/.libs/libjbig2dec.a 32 33unzip -l ${SRC}/${fuzz_target}_seed_corpus.zip 34 35mv $SRC/{*.zip,*.dict,*.options} $OUT 36 37if [ ! -f "${OUT}/${fuzz_target}_seed_corpus.zip" ]; then 38 echo "missing seed corpus" 39 exit 1 40fi 41 42if [ ! -f "${OUT}/${fuzz_target}.dict" ]; then 43 echo "missing dictionary" 44 exit 1 45fi 46 47if [ ! -f "${OUT}/${fuzz_target}.options" ]; then 48 echo "missing options" 49 exit 1 50fi 51