Fix harmless access to uninitialized memory.
When cache invalidations arrive while ri_LoadConstraintInfo() is busy filling a new cache entry, InvalidateConstraintCacheCallBack() compares the - not yet initialized - oidHashValue field with the to-be-invalidated hash value. To fix, check whether the entry is already marked as invalid. Andres Freund
This commit is contained in:
parent
540ac7cea9
commit
f35aef415a
@ -2934,7 +2934,8 @@ InvalidateConstraintCacheCallBack(Datum arg, int cacheid, uint32 hashvalue)
|
||||
hash_seq_init(&status, ri_constraint_cache);
|
||||
while ((hentry = (RI_ConstraintInfo *) hash_seq_search(&status)) != NULL)
|
||||
{
|
||||
if (hashvalue == 0 || hentry->oidHashValue == hashvalue)
|
||||
if (hentry->valid &&
|
||||
(hashvalue == 0 || hentry->oidHashValue == hashvalue))
|
||||
hentry->valid = false;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user