From 40a6b7b37a6e778e702a9b89a5d2c5b273ac51f0 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Wed, 27 Apr 2016 16:48:01 -0700 Subject: [PATCH] Another attempt to ensure that string hashing can't overflow --- pool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pool.cpp b/pool.cpp index dddb12b9..e169fc46 100644 --- a/pool.cpp +++ b/pool.cpp @@ -10,7 +10,7 @@ static int hash(const char *s) { unsigned h = 0; for (; *s; s++) { - h = (h * 37 + *s) & ULONG_MAX; + h = (h * 37LL + (*s & 0xFF)) & ULONG_MAX; } return h & 0xFF; }