]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Add some recursion and looping defenses in prepjointree.c.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 22 Dec 2022 15:35:03 +0000 (10:35 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 22 Dec 2022 15:35:03 +0000 (10:35 -0500)
commit8cd700cc5a676282912c7080cfa142977a2dd851
tree9a904270f5bfee1bd066f0e3f75267c72f9e625c
parent0ff4056b8ce994e2932260c9f194675769b3d2e5
Add some recursion and looping defenses in prepjointree.c.

Andrey Lepikhov demonstrated a case where we spend an unreasonable
amount of time in pull_up_subqueries().  Not only is that recursing
with no explicit check for stack overrun, but the code seems not
interruptable by control-C.  Let's stick a CHECK_FOR_INTERRUPTS
there, along with sprinkling some stack depth checks.

An actual fix for the excessive time consumption seems a bit
risky to back-patch; but this isn't, so let's do so.

Discussion: https://postgr.es/m/703c09a2-08f3-d2ec-b33d-dbecd62428b8@postgrespro.ru
src/backend/optimizer/prep/prepjointree.c