Skip to content

Commit

Permalink
Changes to sleuthkit build.sh script (#12566)
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz authored Oct 14, 2024
1 parent 7a00481 commit 2a5c284
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 342 deletions.
2 changes: 1 addition & 1 deletion projects/sleuthkit/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ FROM gcr.io/oss-fuzz-base/base-builder
RUN apt-get update && apt-get install -y make autoconf automake libtool libz-dev
RUN git clone --depth 1 https://github.com/sleuthkit/sleuthkit sleuthkit
WORKDIR sleuthkit
COPY build.sh buildcorpus.sh sleuthkit_mem_img.h *_fuzzer.cc $SRC/
COPY build.sh $SRC/
50 changes: 12 additions & 38 deletions projects/sleuthkit/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,46 +18,20 @@
export CFLAGS="$CFLAGS -Wno-error=non-c-typedef-for-linkage"
export CXXFLAGS="$CXXFLAGS -Wno-error=non-c-typedef-for-linkage"

# Disable error on all warnings
sed -i 's/-Werror//g' ./tsk/util/Makefile.am
sed -i 's/-Werror//g' ./tsk/pool/Makefile.am
# Work around convolution around building static library versus static binaries
# Also see: https://github.com/sleuthkit/sleuthkit/issues/3020
sed -i 's/-all-static//g' configure.ac

# Dont fail if some of the seed downloads fail.
${SRC}/buildcorpus.sh || true
# Work around hardcoded -Werror flags
# Also see: https://github.com/sleuthkit/sleuthkit/issues/3012
sed -i 's/-Werror//g' Makefile.am

# Don't fail if some of the seed downloads fail.
./ossfuzz/buildcorpus.sh || true

./bootstrap
./configure --enable-static --disable-shared --disable-java --without-afflib --without-libewf --without-libvhdi --without-libvmdk
./configure --enable-static --enable-shared=no --disable-java --without-afflib --without-libcrypto --without-libewf --without-libvhdi --without-libvmdk
make -j$(nproc)

declare -A TSK_FS_TYPES=(
["ext"]="TSK_FS_TYPE_EXT_DETECT"
["fat"]="TSK_FS_TYPE_FAT_DETECT"
["hfs"]="TSK_FS_TYPE_HFS"
["ntfs"]="TSK_FS_TYPE_NTFS"
["iso9660"]="TSK_FS_TYPE_ISO9660"
)

declare -A TSK_VS_TYPES=(
["dos"]="TSK_VS_TYPE_DOS"
["gpt"]="TSK_VS_TYPE_GPT"
["mac"]="TSK_VS_TYPE_MAC"
["sun"]="TSK_VS_TYPE_SUN"
)

# The fls APFS fuzz target has a seperate source file since it uses the libtsk
# pool layer.
$CXX $CXXFLAGS -std=c++14 -I.. -I. -Itsk \
$SRC/sleuthkit_fls_apfs_fuzzer.cc -o $OUT/sleuthkit_fls_apfs_fuzzer \
$LIB_FUZZING_ENGINE $SRC/sleuthkit/tsk/.libs/libtsk.a -lz

for type in ${!TSK_FS_TYPES[@]}; do
$CXX $CXXFLAGS -std=c++14 -I.. -I. -Itsk -DFSTYPE=${TSK_FS_TYPES[$type]} \
$SRC/sleuthkit_fls_fuzzer.cc -o $OUT/sleuthkit_fls_${type}_fuzzer \
$LIB_FUZZING_ENGINE $SRC/sleuthkit/tsk/.libs/libtsk.a -lz
done

for type in ${!TSK_VS_TYPES[@]}; do
$CXX $CXXFLAGS -std=c++14 -I.. -I. -Itsk -DVSTYPE=${TSK_VS_TYPES[$type]} \
$SRC/sleuthkit_mmls_fuzzer.cc -o $OUT/sleuthkit_mmls_${type}_fuzzer \
$LIB_FUZZING_ENGINE $SRC/sleuthkit/tsk/.libs/libtsk.a -lz
done
# Copy the fuzzer binaries to the output directory.
cp *_fuzzer ${OUT}
77 changes: 0 additions & 77 deletions projects/sleuthkit/buildcorpus.sh

This file was deleted.

60 changes: 0 additions & 60 deletions projects/sleuthkit/sleuthkit_fls_apfs_fuzzer.cc

This file was deleted.

43 changes: 0 additions & 43 deletions projects/sleuthkit/sleuthkit_fls_fuzzer.cc

This file was deleted.

75 changes: 0 additions & 75 deletions projects/sleuthkit/sleuthkit_mem_img.h

This file was deleted.

48 changes: 0 additions & 48 deletions projects/sleuthkit/sleuthkit_mmls_fuzzer.cc

This file was deleted.

0 comments on commit 2a5c284

Please sign in to comment.