aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar DavidKorczynski <david@adalogics.com>2022-04-09 18:45:35 +0100
committerGravatar GitHub <noreply@github.com>2022-04-09 18:45:35 +0100
commita98b5b367b787727bec655d05598769f42156cbe (patch)
treeba0c04819e9dce8d0d7fb868fd7241831bf3b462
parent38170a90cc32adfc705ee9aab034fc3ff05f85a3 (diff)
unrar: enable fuzz-introspector (#7545)
-rw-r--r--projects/unrar/build.sh14
1 files changed, 13 insertions, 1 deletions
diff --git a/projects/unrar/build.sh b/projects/unrar/build.sh
index 94696828..e4f65811 100644
--- a/projects/unrar/build.sh
+++ b/projects/unrar/build.sh
@@ -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.