git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e786be5)
Fix use-after-release mistake in currtid() and currtid2() for views
Mon, 1 Jun 2020 05:41:18 +0000 (14:41 +0900)
Mon, 1 Jun 2020 05:41:18 +0000 (14:41 +0900)
This issue has been present since the introduction of this code as of
a3519a2 from 2002, and has been found by buildfarm member prion that
uses RELCACHE_FORCE_RELEASE via the tests introduced recently in
e786be5.

Discussion: https://postgr.es/m/20200601022055.GB4121@paquier.xyz
Backpatch-through: 9.5


diff --git a/src/backend/utils/adt/tid.c b/src/backend/utils/adt/tid.c
index cc699ee2f422d495fe789bf7a61774dc99c4c953..509a0fdffcd6b8528f803cdbe7eca1c90fc6cda8 100644 (file)
--- a/src/backend/utils/adt/tid.c
+++ b/src/backend/utils/adt/tid.c
@@ -338,8 +338,13 @@ currtid_for_view(Relation viewrel, ItemPointer tid)
rte = rt_fetch(var->varno, query->rtable);
if (rte)
{
+ Datum result;
+
+ result = DirectFunctionCall2(currtid_byreloid,
+ ObjectIdGetDatum(rte->relid),
+ PointerGetDatum(tid));
table_close(viewrel, AccessShareLock);
- return DirectFunctionCall2(currtid_byreloid, ObjectIdGetDatum(rte->relid), PointerGetDatum(tid));
+ return result;
}
}
}
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /