From 030c63afd6a727cde7ab7dfbd5887cb1c4d310bf Mon Sep 17 00:00:00 2001 From: Andy Heninger Date: Thu, 2 Jun 2016 19:39:40 +0000 Subject: [PATCH] ICU-12559 avoid signed int overflow in hash computation; it's undefined behavior. X-SVN-Rev: 38782 --- icu4c/source/common/unifiedcache.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/icu4c/source/common/unifiedcache.h b/icu4c/source/common/unifiedcache.h index 35dabbb535c..16c18b0cfb6 100644 --- a/icu4c/source/common/unifiedcache.h +++ b/icu4c/source/common/unifiedcache.h @@ -140,7 +140,7 @@ class LocaleCacheKey : public CacheKey { : CacheKey(other), fLoc(other.fLoc) { } virtual ~LocaleCacheKey() { } virtual int32_t hashCode() const { - return 37 *CacheKey::hashCode() + fLoc.hashCode(); + return (int32_t)(37u * (uint32_t)CacheKey::hashCode() + (uint32_t)fLoc.hashCode()); } virtual UBool operator == (const CacheKeyBase &other) const { // reflexive -- 2.40.0