pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Guard against null plan pointer in CachedPlanIsSimplyValid().
5+ messages / 1 participants
[nested] [flat]

* pgsql: Guard against null plan pointer in CachedPlanIsSimplyValid().
@ 2023-07-20 18:24 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2023-07-20 18:24 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Guard against null plan pointer in CachedPlanIsSimplyValid().

If both the passed-in plan pointer and plansource->gplan are
NULL, CachedPlanIsSimplyValid would think that the plan pointer
is possibly-valid and try to dereference it.  For the one extant
call site in plpgsql, this situation doesn't normally happen
which is why we've not noticed. However, it appears to be possible
if the previous use of the cached plan failed, as per report from
Justin 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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9089287aa037fdecb5a52cec1926e5ae9569e9f9

Modified Files
--------------
src/backend/utils/cache/plancache.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* pgsql: Guard against null plan pointer in CachedPlanIsSimplyValid().
@ 2023-07-20 18:24 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2023-07-20 18:24 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Guard against null plan pointer in CachedPlanIsSimplyValid().

If both the passed-in plan pointer and plansource->gplan are
NULL, CachedPlanIsSimplyValid would think that the plan pointer
is possibly-valid and try to dereference it.  For the one extant
call site in plpgsql, this situation doesn't normally happen
which is why we've not noticed. However, it appears to be possible
if the previous use of the cached plan failed, as per report from
Justin 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

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c0f53139611cf6b24175bea27bfbddb0ea5b7378

Modified Files
--------------
src/backend/utils/cache/plancache.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* pgsql: Guard against null plan pointer in CachedPlanIsSimplyValid().
@ 2023-07-20 18:24 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2023-07-20 18:24 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Guard against null plan pointer in CachedPlanIsSimplyValid().

If both the passed-in plan pointer and plansource->gplan are
NULL, CachedPlanIsSimplyValid would think that the plan pointer
is possibly-valid and try to dereference it.  For the one extant
call site in plpgsql, this situation doesn't normally happen
which is why we've not noticed. However, it appears to be possible
if the previous use of the cached plan failed, as per report from
Justin 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

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/fbaf65cd65f4f0810dab9f2b3e840e68d8b959eb

Modified Files
--------------
src/backend/utils/cache/plancache.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* pgsql: Guard against null plan pointer in CachedPlanIsSimplyValid().
@ 2023-07-20 18:24 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2023-07-20 18:24 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Guard against null plan pointer in CachedPlanIsSimplyValid().

If both the passed-in plan pointer and plansource->gplan are
NULL, CachedPlanIsSimplyValid would think that the plan pointer
is possibly-valid and try to dereference it.  For the one extant
call site in plpgsql, this situation doesn't normally happen
which is why we've not noticed. However, it appears to be possible
if the previous use of the cached plan failed, as per report from
Justin 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

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/10fd061bbc66351bb9cdfc20b65d0c928620e21c

Modified Files
--------------
src/backend/utils/cache/plancache.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* pgsql: Guard against null plan pointer in CachedPlanIsSimplyValid().
@ 2023-07-20 18:24 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2023-07-20 18:24 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Guard against null plan pointer in CachedPlanIsSimplyValid().

If both the passed-in plan pointer and plansource->gplan are
NULL, CachedPlanIsSimplyValid would think that the plan pointer
is possibly-valid and try to dereference it.  For the one extant
call site in plpgsql, this situation doesn't normally happen
which is why we've not noticed. However, it appears to be possible
if the previous use of the cached plan failed, as per report from
Justin 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

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/291c0254025bb67ceedeaca8531f1b14b8aaeeff

Modified Files
--------------
src/backend/utils/cache/plancache.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2023-07-20 18:24 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-07-20 18:24 pgsql: Guard against null plan pointer in CachedPlanIsSimplyValid(). Tom Lane <tgl@sss.pgh.pa.us>
2023-07-20 18:24 pgsql: Guard against null plan pointer in CachedPlanIsSimplyValid(). Tom Lane <tgl@sss.pgh.pa.us>
2023-07-20 18:24 pgsql: Guard against null plan pointer in CachedPlanIsSimplyValid(). Tom Lane <tgl@sss.pgh.pa.us>
2023-07-20 18:24 pgsql: Guard against null plan pointer in CachedPlanIsSimplyValid(). Tom Lane <tgl@sss.pgh.pa.us>
2023-07-20 18:24 pgsql: Guard against null plan pointer in CachedPlanIsSimplyValid(). Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox