pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix list-manipulation bug in WITH RECURSIVE processing.
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix list-manipulation bug in WITH RECURSIVE processing.
@ 2021-02-26 01:47  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2021-02-26 01:47 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix list-manipulation bug in WITH RECURSIVE processing.

makeDependencyGraphWalker and checkWellFormedRecursionWalker
thought they could hold onto a pointer to a list's first
cons cell while the list was modified by recursive calls.
That was okay when the cons cell was actually separately
palloc'd ... but since commit 1cff1b95a, it's quite unsafe,
leading to core dumps or incorrect complaints of faulty
WITH nesting.

In the field this'd require at least a seven-deep WITH nest
to cause an issue, but enabling DEBUG_LIST_MEMORY_USAGE
allows the bug to be seen with lesser nesting depths.

Per bug #16801 from Alexander Lakhin.  Back-patch to v13.

Michael Paquier and Tom Lane

Discussion: https://postgr.es/m/16801-393c7922143eaa4d@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/80ca8464fe02296c8efefd53746e6d6a3f456d1e

Modified Files
--------------
src/backend/parser/parse_cte.c     | 12 ++++----
src/test/regress/expected/with.out | 59 ++++++++++++++++++++++++++++++++++++++
src/test/regress/sql/with.sql      | 44 ++++++++++++++++++++++++++++
3 files changed, 109 insertions(+), 6 deletions(-)



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

* pgsql: Fix list-manipulation bug in WITH RECURSIVE processing.
@ 2021-02-26 01:47  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2021-02-26 01:47 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix list-manipulation bug in WITH RECURSIVE processing.

makeDependencyGraphWalker and checkWellFormedRecursionWalker
thought they could hold onto a pointer to a list's first
cons cell while the list was modified by recursive calls.
That was okay when the cons cell was actually separately
palloc'd ... but since commit 1cff1b95a, it's quite unsafe,
leading to core dumps or incorrect complaints of faulty
WITH nesting.

In the field this'd require at least a seven-deep WITH nest
to cause an issue, but enabling DEBUG_LIST_MEMORY_USAGE
allows the bug to be seen with lesser nesting depths.

Per bug #16801 from Alexander Lakhin.  Back-patch to v13.

Michael Paquier and Tom Lane

Discussion: https://postgr.es/m/16801-393c7922143eaa4d@postgresql.org

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/49076fd3ba6ba7cda2ac16d9aaf554025f0bba2b

Modified Files
--------------
src/backend/parser/parse_cte.c     | 12 ++++----
src/test/regress/expected/with.out | 59 ++++++++++++++++++++++++++++++++++++++
src/test/regress/sql/with.sql      | 44 ++++++++++++++++++++++++++++
3 files changed, 109 insertions(+), 6 deletions(-)



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


end of thread, other threads:[~2021-02-26 01:47 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-02-26 01:47 pgsql: Fix list-manipulation bug in WITH RECURSIVE processing. Tom Lane <tgl@sss.pgh.pa.us>
2021-02-26 01:47 pgsql: Fix list-manipulation bug in WITH RECURSIVE processing. 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