summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllen Winter <allen.winter@kdab.com>2022-10-07 09:47:09 -0400
committerAllen Winter <allen.winter@kdab.com>2022-10-07 09:51:04 -0400
commitd88b09622acf637b07fa86714f9fad9618f8d6e4 (patch)
treeb63e472eb8e4ad674f0a7e064361bcf462f655ae
parent6c0a830af64fb40d1db0f32135dc30c280af6cca (diff)
parentd67034b31cebe0db3ca65342813336b123921a15 (diff)
downloadlibical-git-d88b09622acf637b07fa86714f9fad9618f8d6e4.tar.gz
Merge branch '3.0'
-rwxr-xr-xscripts/buildtests.sh65
-rw-r--r--src/libical/icaltz-util.c2
-rw-r--r--src/libicalss/icalbdbset.c2
-rw-r--r--src/test/regression.c2
4 files changed, 53 insertions, 18 deletions
diff --git a/scripts/buildtests.sh b/scripts/buildtests.sh
index b74b4578..ab870af9 100755
--- a/scripts/buildtests.sh
+++ b/scripts/buildtests.sh
@@ -45,6 +45,7 @@ HELP() {
echo " -d, --no-tsan-build Don't run any TSAN-build (sanitize-threads) tests"
echo " -u, --no-ubsan-build Don't run any UBSAN-build (sanitize-undefined) tests"
echo " -x, --no-memc-build Don't run any MEMCONSIST-build (memory consistency) tests"
+ echo " -f, --no-fortify-build Don't run the FORTIFY-build tests (gcc12)"
echo
}
@@ -206,6 +207,31 @@ GCC_BUILD() {
echo "===== END GCC BUILD: $1 ======"
}
+#function FORTIFY_BUILD:
+# runs a build test using gcc (v12 or higher) with fortify CFLAGS
+# $1 = the name of the test (which will have "-fortify" appended to it)
+# $2 = CMake options
+FORTIFY_BUILD() {
+ name="$1-fortify"
+ if ( test $runfortifybuild -ne 1 )
+ then
+ echo "===== FORTIFY BUILD TEST $1 DISABLED DUE TO COMMAND LINE OPTION ====="
+ return
+ fi
+ COMMAND_EXISTS "gcc"
+ gccVersion=`gcc -dumpversion`
+ if ( test `expr $gccVersion + 0` -lt 12 )
+ then
+ echo "Sorry, gcc must be version 12 or higher to support fortify. Exiting..."
+ exit 1
+ fi
+ echo "===== START FORTIFY BUILD: $1 ======"
+ SET_GCC
+ export CFLAGS="-Og -gdwarf-5 -fno-optimize-sibling-calls -Wall -W -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -D_FORTIFY_SOURCE=3 -fPIC -grecord-gcc-switches -fno-allow-store-data-races -fstack-protector-strong -fstack-clash-protection -fcf-protection=full --param=ssp-buffer-size=1"
+ BUILD "$name" "$2"
+ echo "===== END FORTIFY BUILD: $1 ======"
+}
+
#function NINJA_GCC_BUILD:
# runs a build test using gcc using the Ninja cmake generator
# $1 = the name of the test (which will have "-ninjagcc" appended to it)
@@ -552,7 +578,7 @@ CODESPELL() {
##### END FUNCTIONS #####
-#TEMP=`getopt -o hmkpctbsnlgadu --long help,no-cmake-compat,no-krazy,no-codespell,no-cppcheck,no-tidy,no-scan,no-splint,no-ninja,no-clang-build,no-gcc-build,no-asan-build,no-tsan-build,no-ubsan-build,no-memc-build -- "$@"`
+#TEMP=`getopt -o hmkpctbsnlgaduf --long help,no-cmake-compat,no-krazy,no-codespell,no-cppcheck,no-tidy,no-scan,no-splint,no-ninja,no-clang-build,no-gcc-build,no-asan-build,no-tsan-build,no-ubsan-build,no-memc-build,no-fortify-build -- "$@"`
TEMP=`getopt hmkpctbsnlgadux $*`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
# Note the quotes around `$TEMP': they are essential!
@@ -571,24 +597,26 @@ runasanbuild=1
runtsanbuild=1
runubsanbuild=1
runmemcbuild=1
+runfortifybuild=1
runsplint=1
while true; do
case "$1" in
-h|--help) HELP; exit 1;;
- -m|--no-cmake-compat) cmakecompat=0; shift;;
- -k|--no-krazy) runkrazy=0; shift;;
- -p|--no-codespell) runcodespell=0; shift;;
- -c|--no-cppcheck) runcppcheck=0; shift;;
- -t|--no-tidy) runtidy=0; shift;;
- -b|--no-scan) runscan=0; shift;;
- -s|--no-splint) runsplint=0; shift;;
- -n|--no-ninja) runninja=0; shift;;
- -l|--no-clang-build) runclangbuild=0; shift;;
- -g|--no-gcc-build) rungccbuild=0; shift;;
- -a|--no-asan-build) runasanbuild=0; shift;;
- -d|--no-tsan-build) runtsanbuild=0; shift;;
- -u|--no-ubsan-build) runubsanbuild=0; shift;;
- -x|--no-memc-build) runmemcbuild=0; shift;;
+ -m|--no-cmake-compat) cmakecompat=0; shift;;
+ -k|--no-krazy) runkrazy=0; shift;;
+ -p|--no-codespell) runcodespell=0; shift;;
+ -c|--no-cppcheck) runcppcheck=0; shift;;
+ -t|--no-tidy) runtidy=0; shift;;
+ -b|--no-scan) runscan=0; shift;;
+ -s|--no-splint) runsplint=0; shift;;
+ -n|--no-ninja) runninja=0; shift;;
+ -l|--no-clang-build) runclangbuild=0; shift;;
+ -g|--no-gcc-build) rungccbuild=0; shift;;
+ -a|--no-asan-build) runasanbuild=0; shift;;
+ -d|--no-tsan-build) runtsanbuild=0; shift;;
+ -u|--no-ubsan-build) runubsanbuild=0; shift;;
+ -x|--no-memc-build) runmemcbuild=0; shift;;
+ -f|--no-fortify-build) runfortifybuild=0; shift;;
--) shift; break;;
*) echo "Internal error!"; exit 1;;
esac
@@ -723,4 +751,11 @@ UBSAN_BUILD test3ubsan "$TZCMAKEOPTS"
UBSAN_BUILD test4ubsan "$UUCCMAKEOPTS"
UBSAN_BUILD test5ubsan "$GLIBOPTS"
+#Fortify build
+FORTIFY_BUILD test1fortify "$DEFCMAKEOPTS"
+FORTIFY_BUILD test2tsan "$CMAKEOPTS"
+FORTIFY_BUILD test3tsan "$TZCMAKEOPTS"
+FORTIFY_BUILD test4tsan "$UUCCMAKEOPTS"
+FORTIFY_BUILD test5tsan "$GLIBOPTS"
+
echo "ALL TESTS COMPLETED SUCCESSFULLY"
diff --git a/src/libical/icaltz-util.c b/src/libical/icaltz-util.c
index 2c469c18..4c307056 100644
--- a/src/libical/icaltz-util.c
+++ b/src/libical/icaltz-util.c
@@ -749,7 +749,7 @@ icalcomponent *icaltzutil_fetch_timezone(const char *location)
for (i = 0; i < num_trans; i++) {
int by_day = 0;
icaltime_t start;
- enum icalrecurrencetype_weekday dow;
+ enum icalrecurrencetype_weekday dow = ICAL_NO_WEEKDAY;
prev_idx = idx;
idx = trans_idx[i];
diff --git a/src/libicalss/icalbdbset.c b/src/libicalss/icalbdbset.c
index e8a4f206..76216847 100644
--- a/src/libicalss/icalbdbset.c
+++ b/src/libicalss/icalbdbset.c
@@ -521,7 +521,7 @@ int icalbdbset_get_key(DBC *dbcp, DBT *key, DBT *data)
int icalbdbset_delete(DB *dbp, DBT *key)
{
DB_TXN *tid;
- int ret;
+ int ret = 0;
int done = 0;
int retry = 0;
diff --git a/src/test/regression.c b/src/test/regression.c
index d00979c3..4dfe2a19 100644
--- a/src/test/regression.c
+++ b/src/test/regression.c
@@ -2409,7 +2409,7 @@ void test_fblist()
char *strp = out_str;
for (i = 0; foo[i] != -1; i++) {
- snprintf(strp, 79, "%1d", foo[i]);
+ snprintf(strp, 79-i, "%1d", foo[i]);
strp++;
}
str_is("Checking freebusy validity", out_str, "1121110");