From: Timo Sirainen Date: Mon, 16 Aug 2021 12:36:37 +0000 (+0300) Subject: global: Add ATTR_UNSIGNED_WRAPS to fix various ubsan issues X-Git-Tag: 2.3.17~188 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b82faee3cbb5a0ce813093d740b27e9eb58239b9;p=thirdparty%2Fdovecot%2Fcore.git global: Add ATTR_UNSIGNED_WRAPS to fix various ubsan issues --- diff --git a/src/auth/crypt-blowfish.c b/src/auth/crypt-blowfish.c index afb2841b07..460f8cf688 100644 --- a/src/auth/crypt-blowfish.c +++ b/src/auth/crypt-blowfish.c @@ -437,7 +437,8 @@ static void BF_encode(char *dst, const BF_word *src, size_t size) } while (sptr < end); } -static void BF_swap(BF_word *x, int count) +static void ATTR_UNSIGNED_WRAPS +BF_swap(BF_word *x, int count) { static int endianness_check = 1; char *is_little_endian = (char *)&endianness_check; @@ -534,7 +535,8 @@ static void BF_swap(BF_word *x, int count) *(ptr - 1) = R; \ } while (ptr < &data.ctx.S[3][0xFF]); -static void BF_set_key(const char *key, BF_key expanded, BF_key initial, +static void ATTR_UNSIGNED_WRAPS +BF_set_key(const char *key, BF_key expanded, BF_key initial, unsigned char flags) { const char *ptr = key; diff --git a/src/lib/numpack.c b/src/lib/numpack.c index 51cc0271ed..8a59f3a01d 100644 --- a/src/lib/numpack.c +++ b/src/lib/numpack.c @@ -16,6 +16,7 @@ void numpack_encode(buffer_t *buf, uint64_t num) } int numpack_decode(const uint8_t **p, const uint8_t *end, uint64_t *num_r) + ATTR_UNSIGNED_WRAPS { const uint8_t *c = *p; uint64_t value = 0; diff --git a/src/lib/sha3.c b/src/lib/sha3.c index a8c0b14d5d..3b40ddd524 100644 --- a/src/lib/sha3.c +++ b/src/lib/sha3.c @@ -69,7 +69,7 @@ static const unsigned keccakf_piln[24] = { /* generally called after SHA3_KECCAK_SPONGE_WORDS-ctx->capacityWords words * are XORed into the state s */ -static void +static void ATTR_UNSIGNED_WRAPS keccakf(uint64_t s[25]) { int i, j, round;