Fix object hashing in schema

This commit is contained in:
Aikawa Yataro 2023-09-28 09:10:05 +02:00 committed by Milo Yip
parent b4a6da3e63
commit eee82cb078
1 changed files with 3 additions and 1 deletions

View File

@ -367,7 +367,9 @@ public:
uint64_t h = Hash(0, kObjectType);
uint64_t* kv = stack_.template Pop<uint64_t>(memberCount * 2);
for (SizeType i = 0; i < memberCount; i++)
h ^= Hash(kv[i * 2], kv[i * 2 + 1]); // Use xor to achieve member order insensitive
// Issue #2205
// Hasing the key to avoid key=value cases with bug-prone zero-value hash
h ^= Hash(Hash(0, kv[i * 2]), kv[i * 2 + 1]); // Use xor to achieve member order insensitive
*stack_.template Push<uint64_t>() = h;
return true;
}