unrar: enable fuzz-introspector (#7545)

This commit is contained in:
DavidKorczynski 2022-04-09 18:45:35 +01:00 committed by GitHub
parent 38170a90cc
commit a98b5b367b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 1 deletions

View File

@ -15,6 +15,18 @@
#
################################################################################
# Fuzz introspector uses LDFLAGS, so ensure LDFLAGS
# is always set for other sanitizer options.
if [ "$SANITIZER" != "introspector" ]; then
export LDFLAGS=""
else
# We need to add -flto flags because the makefile in unrar does not
# pass cxxflags, which holds the -flto flag from fuzz-introspector.
# This should probably be updated in the future, namely, including
# -flto into LDFLAGS in OSS-Fuzz fuzz-introspector builds.
export LDFLAGS="${LDFLAGS} -flto"
fi
UNRAR_DEFINES="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DRAR_SMP -DRARDLL -DSILENT -DNOVOLUME"
UNRAR_WNOS="-Wno-logical-op-parentheses -Wno-switch -Wno-dangling-else"
UNRAR_SRC_DIR="$SRC/unrar"
@ -25,7 +37,7 @@ CXXFLAGS="$CXXFLAGS -fno-sanitize=enum"
# build 'lib'. This builds libunrar.a and libunrar.so
# -fPIC is required for successful compilation.
make CXX=$CXX CXXFLAGS="$CXXFLAGS -fPIC $UNRAR_DEFINES $UNRAR_WNOS" \
make CXX=$CXX LDFLAGS="$LDFLAGS" CXXFLAGS="$CXXFLAGS -fPIC $UNRAR_DEFINES $UNRAR_WNOS" \
-C $UNRAR_SRC_DIR lib
# remove the .so file so that the linker links unrar statically.