Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit445c7e3

Browse files
committed
Backpatch missing check_stack_depth() to some recursive functions
Backpatch changes fromd57b7cc,75bcba6 to all supported branches perproposal of Egor Chindyaskin.Discussion:https://postgr.es/m/DE5FD776-A8CD-4378-BCFA-3BF30F1F6D60%40mail.ru
1 parent20b85b3 commit445c7e3

File tree

5 files changed

+30
-0
lines changed

5 files changed

+30
-0
lines changed

‎src/backend/catalog/dependency.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
#include"commands/sequence.h"
7474
#include"commands/trigger.h"
7575
#include"commands/typecmds.h"
76+
#include"miscadmin.h"
7677
#include"nodes/nodeFuncs.h"
7778
#include"parser/parsetree.h"
7879
#include"rewrite/rewriteRemove.h"
@@ -510,6 +511,12 @@ findDependentObjects(const ObjectAddress *object,
510511
if (stack_address_present_add_flags(object,objflags,stack))
511512
return;
512513

514+
/*
515+
* since this function recurses, it could be driven to stack overflow,
516+
* because of the deep dependency tree, not only due to dependency loops.
517+
*/
518+
check_stack_depth();
519+
513520
/*
514521
* It's also possible that the target object has already been completely
515522
* processed and put into targetObjects. If so, again we just add the

‎src/backend/catalog/heap.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,9 @@ CheckAttributeType(const char *attname,
593593
charatt_typtype=get_typtype(atttypid);
594594
Oidatt_typelem;
595595

596+
/* since this function recurses, it could be driven to stack overflow */
597+
check_stack_depth();
598+
596599
if (att_typtype==TYPTYPE_PSEUDO)
597600
{
598601
/*

‎src/backend/commands/tablecmds.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6231,6 +6231,9 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
62316231
AclResultaclresult;
62326232
ObjectAddress address;
62336233

6234+
/* since this function recurses, it could be driven to stack overflow */
6235+
check_stack_depth();
6236+
62346237
/* At top level, permission check was done in ATPrepCmd, else do it */
62356238
if (recursing)
62366239
ATSimplePermissions(rel, ATT_TABLE | ATT_FOREIGN_TABLE);
@@ -7956,6 +7959,10 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName,
79567959

79577960
/* Initialize addrs on the first invocation */
79587961
Assert(!recursing || addrs != NULL);
7962+
7963+
/* since this function recurses, it could be driven to stack overflow */
7964+
check_stack_depth();
7965+
79597966
if (!recursing)
79607967
addrs = new_object_addresses();
79617968

@@ -10086,6 +10093,9 @@ ATExecAlterConstrRecurse(Constraint *cmdcon, Relation conrel, Relation tgrel,
1008610093
Oidrefrelid;
1008710094
boolchanged = false;
1008810095

10096+
/* since this function recurses, it could be driven to stack overflow */
10097+
check_stack_depth();
10098+
1008910099
currcon = (Form_pg_constraint) GETSTRUCT(contuple);
1009010100
conoid = currcon->oid;
1009110101
refrelid = currcon->confrelid;
@@ -11067,6 +11077,9 @@ ATExecDropConstraint(Relation rel, const char *constrName,
1106711077
boolis_no_inherit_constraint = false;
1106811078
charcontype;
1106911079

11080+
/* since this function recurses, it could be driven to stack overflow */
11081+
check_stack_depth();
11082+
1107011083
/* At top level, permission check was done in ATPrepCmd, else do it */
1107111084
if (recursing)
1107211085
ATSimplePermissions(rel, ATT_TABLE | ATT_FOREIGN_TABLE);

‎src/backend/optimizer/util/clauses.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2456,6 +2456,10 @@ static Node *
24562456
eval_const_expressions_mutator(Node*node,
24572457
eval_const_expressions_context*context)
24582458
{
2459+
2460+
/* since this function recurses, it could be driven to stack overflow */
2461+
check_stack_depth();
2462+
24592463
if (node==NULL)
24602464
returnNULL;
24612465
switch (nodeTag(node))

‎src/backend/utils/adt/jsonpath_exec.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,6 +1235,9 @@ executeBoolItem(JsonPathExecContext *cxt, JsonPathItem *jsp,
12351235
JsonPathBoolres;
12361236
JsonPathBoolres2;
12371237

1238+
/* since this function recurses, it could be driven to stack overflow */
1239+
check_stack_depth();
1240+
12381241
if (!canHaveNext&&jspHasNext(jsp))
12391242
elog(ERROR,"boolean jsonpath item cannot have next item");
12401243

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp