Misc improvements to build_av1_dec_fuzzer.sh
1. Avoid the bash "unbound variable" error if the environment variable
CC or CXX is not set.
2. Build with assertions enabled. This matches how oss-fuzz builds
libaom.
3. Compile av1_dec_fuzzer.cc with debug symbols.
Change-Id: Ie08a85b8d7258fd7a2099ab4ec8b800acc22c792
diff --git a/examples/build_av1_dec_fuzzer.sh b/examples/build_av1_dec_fuzzer.sh
index 0dcb254..2ceb652 100755
--- a/examples/build_av1_dec_fuzzer.sh
+++ b/examples/build_av1_dec_fuzzer.sh
@@ -33,11 +33,11 @@
echo " git clone https://aomedia.googlesource.com/aom"
exit 2
fi
-if [[ -z "$CC" ]]; then
+if [[ -z "${CC:-}" ]]; then
echo "Set the CC environment variable to point to your C compiler."
exit 2
fi
-if [[ -z "$CXX" ]]; then
+if [[ -z "${CXX:-}" ]]; then
echo "Set the CXX environment variable to point to your C++ compiler."
exit 2
fi
@@ -47,7 +47,7 @@
# Run CMake with address sanitizer enabled and build the codec.
# Enable DO_RANGE_CHECK_CLAMP to suppress the noise of integer overflows
# in the transform functions. Also set memory limits.
-EXTRA_C_FLAGS='-DDO_RANGE_CHECK_CLAMP=1 -DAOM_MAX_ALLOCABLE_MEMORY=1073741824'
+EXTRA_C_FLAGS='-UNDEBUG -DDO_RANGE_CHECK_CLAMP=1 -DAOM_MAX_ALLOCABLE_MEMORY=1073741824'
cd "${BUILD_DIR}"
cmake "${AOM_DIR}" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONFIG_PIC=1 \
-DCONFIG_SCALABILITY=0 -DFORCE_HIGHBITDEPTH_DECODING=0 \
@@ -61,7 +61,7 @@
# Build the av1 fuzzer
$CXX -std=c++11 -DDECODER=av1 -I${AOM_DIR} -I${BUILD_DIR} \
- -fsanitize=fuzzer,address -Wl,--start-group \
+ -g -fsanitize=fuzzer,address -Wl,--start-group \
${AOM_DIR}/examples/av1_dec_fuzzer.cc -o ${BUILD_DIR}/av1_dec_fuzzer \
${BUILD_DIR}/libaom.a -Wl,--end-group