Backpatch missing check_stack_depth() to some recursive functions
Backpatch changes from d57b7cc333, 75bcba6cbd to all supported branches per proposal of Egor Chindyaskin. Discussion: https://postgr.es/m/DE5FD776-A8CD-4378-BCFA-3BF30F1F6D60%40mail.ru
This commit is contained in:
parent
20b85b3da6
commit
445c7e38f6
@ -73,6 +73,7 @@
|
|||||||
#include "commands/sequence.h"
|
#include "commands/sequence.h"
|
||||||
#include "commands/trigger.h"
|
#include "commands/trigger.h"
|
||||||
#include "commands/typecmds.h"
|
#include "commands/typecmds.h"
|
||||||
|
#include "miscadmin.h"
|
||||||
#include "nodes/nodeFuncs.h"
|
#include "nodes/nodeFuncs.h"
|
||||||
#include "parser/parsetree.h"
|
#include "parser/parsetree.h"
|
||||||
#include "rewrite/rewriteRemove.h"
|
#include "rewrite/rewriteRemove.h"
|
||||||
@ -510,6 +511,12 @@ findDependentObjects(const ObjectAddress *object,
|
|||||||
if (stack_address_present_add_flags(object, objflags, stack))
|
if (stack_address_present_add_flags(object, objflags, stack))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* since this function recurses, it could be driven to stack overflow,
|
||||||
|
* because of the deep dependency tree, not only due to dependency loops.
|
||||||
|
*/
|
||||||
|
check_stack_depth();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* It's also possible that the target object has already been completely
|
* It's also possible that the target object has already been completely
|
||||||
* processed and put into targetObjects. If so, again we just add the
|
* processed and put into targetObjects. If so, again we just add the
|
||||||
|
@ -593,6 +593,9 @@ CheckAttributeType(const char *attname,
|
|||||||
char att_typtype = get_typtype(atttypid);
|
char att_typtype = get_typtype(atttypid);
|
||||||
Oid att_typelem;
|
Oid att_typelem;
|
||||||
|
|
||||||
|
/* since this function recurses, it could be driven to stack overflow */
|
||||||
|
check_stack_depth();
|
||||||
|
|
||||||
if (att_typtype == TYPTYPE_PSEUDO)
|
if (att_typtype == TYPTYPE_PSEUDO)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -6231,6 +6231,9 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
|
|||||||
AclResult aclresult;
|
AclResult aclresult;
|
||||||
ObjectAddress address;
|
ObjectAddress address;
|
||||||
|
|
||||||
|
/* since this function recurses, it could be driven to stack overflow */
|
||||||
|
check_stack_depth();
|
||||||
|
|
||||||
/* At top level, permission check was done in ATPrepCmd, else do it */
|
/* At top level, permission check was done in ATPrepCmd, else do it */
|
||||||
if (recursing)
|
if (recursing)
|
||||||
ATSimplePermissions(rel, ATT_TABLE | ATT_FOREIGN_TABLE);
|
ATSimplePermissions(rel, ATT_TABLE | ATT_FOREIGN_TABLE);
|
||||||
@ -7956,6 +7959,10 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName,
|
|||||||
|
|
||||||
/* Initialize addrs on the first invocation */
|
/* Initialize addrs on the first invocation */
|
||||||
Assert(!recursing || addrs != NULL);
|
Assert(!recursing || addrs != NULL);
|
||||||
|
|
||||||
|
/* since this function recurses, it could be driven to stack overflow */
|
||||||
|
check_stack_depth();
|
||||||
|
|
||||||
if (!recursing)
|
if (!recursing)
|
||||||
addrs = new_object_addresses();
|
addrs = new_object_addresses();
|
||||||
|
|
||||||
@ -10086,6 +10093,9 @@ ATExecAlterConstrRecurse(Constraint *cmdcon, Relation conrel, Relation tgrel,
|
|||||||
Oid refrelid;
|
Oid refrelid;
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
|
/* since this function recurses, it could be driven to stack overflow */
|
||||||
|
check_stack_depth();
|
||||||
|
|
||||||
currcon = (Form_pg_constraint) GETSTRUCT(contuple);
|
currcon = (Form_pg_constraint) GETSTRUCT(contuple);
|
||||||
conoid = currcon->oid;
|
conoid = currcon->oid;
|
||||||
refrelid = currcon->confrelid;
|
refrelid = currcon->confrelid;
|
||||||
@ -11067,6 +11077,9 @@ ATExecDropConstraint(Relation rel, const char *constrName,
|
|||||||
bool is_no_inherit_constraint = false;
|
bool is_no_inherit_constraint = false;
|
||||||
char contype;
|
char contype;
|
||||||
|
|
||||||
|
/* since this function recurses, it could be driven to stack overflow */
|
||||||
|
check_stack_depth();
|
||||||
|
|
||||||
/* At top level, permission check was done in ATPrepCmd, else do it */
|
/* At top level, permission check was done in ATPrepCmd, else do it */
|
||||||
if (recursing)
|
if (recursing)
|
||||||
ATSimplePermissions(rel, ATT_TABLE | ATT_FOREIGN_TABLE);
|
ATSimplePermissions(rel, ATT_TABLE | ATT_FOREIGN_TABLE);
|
||||||
|
@ -2456,6 +2456,10 @@ static Node *
|
|||||||
eval_const_expressions_mutator(Node *node,
|
eval_const_expressions_mutator(Node *node,
|
||||||
eval_const_expressions_context *context)
|
eval_const_expressions_context *context)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/* since this function recurses, it could be driven to stack overflow */
|
||||||
|
check_stack_depth();
|
||||||
|
|
||||||
if (node == NULL)
|
if (node == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
switch (nodeTag(node))
|
switch (nodeTag(node))
|
||||||
|
@ -1235,6 +1235,9 @@ executeBoolItem(JsonPathExecContext *cxt, JsonPathItem *jsp,
|
|||||||
JsonPathBool res;
|
JsonPathBool res;
|
||||||
JsonPathBool res2;
|
JsonPathBool res2;
|
||||||
|
|
||||||
|
/* since this function recurses, it could be driven to stack overflow */
|
||||||
|
check_stack_depth();
|
||||||
|
|
||||||
if (!canHaveNext && jspHasNext(jsp))
|
if (!canHaveNext && jspHasNext(jsp))
|
||||||
elog(ERROR, "boolean jsonpath item cannot have next item");
|
elog(ERROR, "boolean jsonpath item cannot have next item");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user