Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9089287

Browse files
committed
Guard against null plan pointer in CachedPlanIsSimplyValid().
If both the passed-in plan pointer and plansource->gplan areNULL, CachedPlanIsSimplyValid would think that the plan pointeris possibly-valid and try to dereference it. For the one extantcall site in plpgsql, this situation doesn't normally happenwhich is why we've not noticed. However, it appears to be possibleif the previous use of the cached plan failed, as per report fromJustin Pryzby. Add an extra check to prevent crashing.Back-patch to v13 where this code was added.Discussion:https://postgr.es/m/ZLlV+STFz1l/WhAQ@telsasoft.com
1 parent29a0ccb commit9089287

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

‎src/backend/utils/cache/plancache.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1440,7 +1440,9 @@ CachedPlanIsSimplyValid(CachedPlanSource *plansource, CachedPlan *plan,
14401440
* that here we *do* check plansource->is_valid, so as to force plan
14411441
* rebuild if that's become false.
14421442
*/
1443-
if (!plansource->is_valid||plan!=plansource->gplan|| !plan->is_valid)
1443+
if (!plansource->is_valid||
1444+
plan==NULL||plan!=plansource->gplan||
1445+
!plan->is_valid)
14441446
return false;
14451447

14461448
Assert(plan->magic==CACHEDPLAN_MAGIC);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp