mirror of
https://github.com/postgres/postgres.git
synced 2025-04-25 21:42:33 +03:00
Catch stack overflow when recursing in transformFromClauseItem().
Most parts of the parser can expect that the stack overflow check in transformExprRecurse() will trigger before things get desperate. However, transformFromClauseItem() can recurse directly to self without having analyzed any expressions, so it's possible to drive it to a stack-overrun crash. Add a check to prevent that. Per bug #17583 from Egor Chindyaskin. Back-patch to all supported branches. Richard Guo Discussion: https://postgr.es/m/17583-33be55b9f981f75c@postgresql.org
This commit is contained in:
parent
8b2638fdd4
commit
60f876317e
@ -1055,6 +1055,9 @@ transformFromClauseItem(ParseState *pstate, Node *n,
|
|||||||
ParseNamespaceItem **top_nsitem,
|
ParseNamespaceItem **top_nsitem,
|
||||||
List **namespace)
|
List **namespace)
|
||||||
{
|
{
|
||||||
|
/* Guard against stack overflow due to overly deep subtree */
|
||||||
|
check_stack_depth();
|
||||||
|
|
||||||
if (IsA(n, RangeVar))
|
if (IsA(n, RangeVar))
|
||||||
{
|
{
|
||||||
/* Plain relation reference, or perhaps a CTE reference */
|
/* Plain relation reference, or perhaps a CTE reference */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user