From: Timo Sirainen Date: Fri, 1 Oct 2021 12:21:38 +0000 (+0300) Subject: lib: str_hash() - Ignore integer wrapping with ubsan X-Git-Tag: 2.3.18~272 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=088783cdaafd20092925e2d07905a25f7e39b625;p=thirdparty%2Fdovecot%2Fcore.git lib: str_hash() - Ignore integer wrapping with ubsan ATTR_NO_SANITIZE_INTEGER was already set for other hash functions, but forgotten for this one. Fixes e.g.: Error: hash.c:529:16: runtime error: unsigned integer overflow: 4294967200 + 115 cannot be represented in type ‘unsigned int’ --- diff --git a/src/lib/hash.c b/src/lib/hash.c index 16f3c96723..5530de19a1 100644 --- a/src/lib/hash.c +++ b/src/lib/hash.c @@ -520,7 +520,8 @@ void hash_table_copy(struct hash_table *dest, struct hash_table *src) } /* a char* hash function from ASU -- from glib */ -unsigned int str_hash(const char *p) +unsigned int ATTR_NO_SANITIZE_INTEGER +str_hash(const char *p) { const unsigned char *s = (const unsigned char *)p; unsigned int g, h = 0;