Content-Length: 259422 | pFad | http://github.com/postgrespro/postgres/commit/f35aef415aa755c4e99f8c0ef83f9d14dbc48bb4

A3 Fix harmless access to uninitialized memory. · postgrespro/postgres@f35aef4 · GitHub
Skip to content

Commit f35aef4

Browse files
committed
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
1 parent 540ac7c commit f35aef4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/backend/utils/adt/ri_triggers.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2934,7 +2934,8 @@ InvalidateConstraintCacheCallBack(Datum arg, int cacheid, uint32 hashvalue)
29342934
hash_seq_init(&status, ri_constraint_cache);
29352935
while ((hentry = (RI_ConstraintInfo *) hash_seq_search(&status)) != NULL)
29362936
{
2937-
if (hashvalue == 0 || hentry->oidHashValue == hashvalue)
2937+
if (hentry->valid &&
2938+
(hashvalue == 0 || hentry->oidHashValue == hashvalue))
29382939
hentry->valid = false;
29392940
}
29402941
}

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/f35aef415aa755c4e99f8c0ef83f9d14dbc48bb4

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy