1#!/bin/bash -eu 2# Copyright 2020 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 18export CFLAGS="$CFLAGS -Wno-error=non-c-typedef-for-linkage" 19export CXXFLAGS="$CXXFLAGS -Wno-error=non-c-typedef-for-linkage" 20 21${SRC}/buildcorpus.sh 22 23./bootstrap 24./configure --enable-static --disable-shared --disable-java --without-afflib --without-libewf --without-libvhdi --without-libvmdk 25make -j$(nproc) 26 27declare -A TSK_FS_TYPES=( 28 ["ext"]="TSK_FS_TYPE_EXT_DETECT" 29 ["fat"]="TSK_FS_TYPE_FAT_DETECT" 30 ["hfs"]="TSK_FS_TYPE_HFS" 31 ["ntfs"]="TSK_FS_TYPE_NTFS" 32 ["iso9660"]="TSK_FS_TYPE_ISO9660" 33) 34 35declare -A TSK_VS_TYPES=( 36 ["dos"]="TSK_VS_TYPE_DOS" 37 ["gpt"]="TSK_VS_TYPE_GPT" 38 ["mac"]="TSK_VS_TYPE_MAC" 39 ["sun"]="TSK_VS_TYPE_SUN" 40) 41 42# The fls APFS fuzz target has a seperate source file since it uses the libtsk 43# pool layer. 44$CXX $CXXFLAGS -std=c++14 -I.. -I. -Itsk \ 45 $SRC/sleuthkit_fls_apfs_fuzzer.cc -o $OUT/sleuthkit_fls_apfs_fuzzer \ 46 $LIB_FUZZING_ENGINE $SRC/sleuthkit/tsk/.libs/libtsk.a 47 48for type in ${!TSK_FS_TYPES[@]}; do 49 $CXX $CXXFLAGS -std=c++14 -I.. -I. -Itsk -DFSTYPE=${TSK_FS_TYPES[$type]} \ 50 $SRC/sleuthkit_fls_fuzzer.cc -o $OUT/sleuthkit_fls_${type}_fuzzer \ 51 $LIB_FUZZING_ENGINE $SRC/sleuthkit/tsk/.libs/libtsk.a 52done 53 54for type in ${!TSK_VS_TYPES[@]}; do 55 $CXX $CXXFLAGS -std=c++14 -I.. -I. -Itsk -DVSTYPE=${TSK_VS_TYPES[$type]} \ 56 $SRC/sleuthkit_mmls_fuzzer.cc -o $OUT/sleuthkit_mmls_${type}_fuzzer \ 57 $LIB_FUZZING_ENGINE $SRC/sleuthkit/tsk/.libs/libtsk.a 58done 59