path: root/st.c
diff options
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-07 04:09:05 (GMT)
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-07 04:09:05 (GMT)
commit234ffbce0e17464b0c174e3567ffe34917277229 (patch)
tree2cca7ecd4720a332a32520c7d92a07cb8c071398 /st.c
parentc818b2fcf4652869799057556fc528e02288e248 (diff)
blacklist UBSAN's unsigned integer overflow
Integer overflow for unsigned types are fully defined in C. They are not always problematic (but not always OK). These functions in this changeset intentionally utilizes that behaviour. Blacklist from UBSAN checks for better output. See also: git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'st.c')
1 files changed, 5 insertions, 1 deletions
diff --git a/st.c b/st.c
index fd564b6..1d3d48b 100644
--- a/st.c
+++ b/st.c
@@ -1766,6 +1766,10 @@ st_values_check(st_table *tab, st_data_t *values, st_index_t size,
#define C1 BIG_CONSTANT(0x87c37b91,0x114253d5);
#define C2 BIG_CONSTANT(0x4cf5ad43,0x2745937f);
+NO_SANITIZE("unsigned-integer-overflow", static inline st_index_t murmur_step(st_index_t h, st_index_t k));
+NO_SANITIZE("unsigned-integer-overflow", static inline st_index_t murmur_finish(st_index_t h));
+NO_SANITIZE("unsigned-integer-overflow", extern st_index_t st_hash(const void *ptr, size_t len, st_index_t h));
static inline st_index_t
murmur_step(st_index_t h, st_index_t k)
@@ -2052,7 +2056,7 @@ st_locale_insensitive_strncasecmp(const char *s1, const char *s2, size_t n)
return 0;
-PUREFUNC(static st_index_t strcasehash(st_data_t));
+NO_SANITIZE("unsigned-integer-overflow", PUREFUNC(static st_index_t strcasehash(st_data_t)));
static st_index_t
strcasehash(st_data_t arg)