ICU-12559 avoid signed int overflow in hash computation; it's undefined behavior.

X-SVN-Rev: 38782
This commit is contained in:
Andy Heninger 2016-06-02 19:39:40 +00:00
parent 41fed01112
commit 030c63afd6

View file

@ -140,7 +140,7 @@ class LocaleCacheKey : public CacheKey<T> {
: CacheKey<T>(other), fLoc(other.fLoc) { }
virtual ~LocaleCacheKey() { }
virtual int32_t hashCode() const {
return 37 *CacheKey<T>::hashCode() + fLoc.hashCode();
return (int32_t)(37u * (uint32_t)CacheKey<T>::hashCode() + (uint32_t)fLoc.hashCode());
}
virtual UBool operator == (const CacheKeyBase &other) const {
// reflexive