Allow using UBSan's unsigned-overflow check
commit501bddf177275d87a46f7a659aa3a0b0d85ee4c8
authorOlly Betts <olly@survex.com>
Wed, 16 Aug 2023 04:51:11 +0000 (16 16:51 +1200)
committerOlly Betts <olly@survex.com>
Wed, 16 Aug 2023 04:57:43 +0000 (16 16:57 +1200)
treeadd98b89bf15d1e4f5e09e69d26f324cfacd8a9e
parentc75952cf14b3943c94315c4887223c750cd923cd
Allow using UBSan's unsigned-overflow check

In C and C++ unsigned overflow has defined behaviour (unlike signed
overflow) but in many cases it happening is not intended and indicates
a bug.

UBSan supports an unsigned-overflow check (at least the clang version
does - currently the GCC version doesn't seem to) so I've annotated the
few places in the code where we deliberately rely on unsigned overflow
(and eliminated a few cases where we can easily not rely on it) and
added this check to the clang-sanitisers job.
41 files changed:
.github/workflows/ci.yml
xapian-applications/omega/Makefile.am
xapian-applications/omega/configure.ac
xapian-applications/omega/md5.cc
xapian-applications/omega/omegatest.pl
xapian-applications/omega/query.cc
xapian-applications/omega/scriptindex.cc
xapian-applications/omega/sort.cc
xapian-applications/omega/ubsan.supp [new file with mode: 0644]
xapian-applications/omega/urlencode.cc
xapian-core/api/compactor.cc
xapian-core/api/mset.cc
xapian-core/api/queryinternal.cc
xapian-core/backends/databaseinternal.cc
xapian-core/backends/glass/glass_compact.cc
xapian-core/backends/glass/glass_database.cc
xapian-core/backends/glass/glass_inverter.h
xapian-core/backends/glass/glass_postlist.cc
xapian-core/backends/glass/glass_values.cc
xapian-core/backends/honey/honey_compact.cc
xapian-core/backends/honey/honey_inverter.h
xapian-core/backends/inmemory/inmemory_positionlist.cc
xapian-core/backends/multi/multi_database.cc
xapian-core/backends/remote/remote-database.cc
xapian-core/common/bitstream.cc
xapian-core/common/negate_unsigned.h
xapian-core/configure.ac
xapian-core/include/xapian/unicode.h
xapian-core/matcher/matcher.cc
xapian-core/matcher/maxpostlist.cc
xapian-core/matcher/xorpostlist.cc
xapian-core/net/remoteserver.cc
xapian-core/net/serialise.cc
xapian-core/queryparser/queryparser.lemony
xapian-core/queryparser/queryparser.lt
xapian-core/queryparser/termgenerator_internal.cc
xapian-core/tests/Makefile.am
xapian-core/tests/api_wrdb.cc
xapian-core/tests/runtest.in
xapian-core/tests/ubsan.supp [new file with mode: 0644]
xapian-core/tests/unittest.cc