From 5a34404b1ada805b884813ce3ed1c345d4d56c1e Mon Sep 17 00:00:00 2001 From: Andy Green <andy@warmcat.com> Date: Thu, 16 Jan 2025 10:34:53 +0000 Subject: [PATCH] coverity 872858: hash gen overflow false positive Help it ignore that we use the MS 7 bits in the next part of the operation and discard it in the first part. --- lib/core/lws_map.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/core/lws_map.c b/lib/core/lws_map.c index b319d79f4..3578aa801 100644 --- a/lib/core/lws_map.c +++ b/lib/core/lws_map.c @@ -88,7 +88,10 @@ lws_map_hash_from_key_default(const lws_map_key_t key, size_t kl) const uint8_t *u = (const uint8_t *)key; while (kl--) - h = ((((h << 7) | (h >> 25)) + 0xa1b2c3d4) ^ (*u++)) ^ h; + h = (( + (((h & 0x1fffffff /* coverity */ ) << 7) | + (h >> 25)) + + 0xa1b2c3d4) ^ (*u++)) ^ h; return h; }