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

Commit84788ee

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 parentab64b27 commit84788ee

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
@@ -75,6 +75,7 @@
7575
#include"commands/trigger.h"
7676
#include"commands/typecmds.h"
7777
#include"funcapi.h"
78+
#include"miscadmin.h"
7879
#include"nodes/nodeFuncs.h"
7980
#include"parser/parsetree.h"
8081
#include"rewrite/rewriteRemove.h"
@@ -516,6 +517,12 @@ findDependentObjects(const ObjectAddress *object,
516517
if (stack_address_present_add_flags(object,objflags,stack))
517518
return;
518519

520+
/*
521+
* since this function recurses, it could be driven to stack overflow,
522+
* because of the deep dependency tree, not only due to dependency loops.
523+
*/
524+
check_stack_depth();
525+
519526
/*
520527
* It's also possible that the target object has already been completely
521528
* 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
@@ -552,6 +552,9 @@ CheckAttributeType(const char *attname,
552552
charatt_typtype=get_typtype(atttypid);
553553
Oidatt_typelem;
554554

555+
/* since this function recurses, it could be driven to stack overflow */
556+
check_stack_depth();
557+
555558
if (att_typtype==TYPTYPE_PSEUDO)
556559
{
557560
/*

‎src/backend/commands/tablecmds.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6745,6 +6745,9 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
67456745
TupleDesctupdesc;
67466746
FormData_pg_attribute *aattr[] = {&attribute};
67476747

6748+
/* since this function recurses, it could be driven to stack overflow */
6749+
check_stack_depth();
6750+
67486751
/* At top level, permission check was done in ATPrepCmd, else do it */
67496752
if (recursing)
67506753
ATSimplePermissions((*cmd)->subtype, rel, ATT_TABLE | ATT_FOREIGN_TABLE);
@@ -8477,6 +8480,10 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName,
84778480

84788481
/* Initialize addrs on the first invocation */
84798482
Assert(!recursing || addrs != NULL);
8483+
8484+
/* since this function recurses, it could be driven to stack overflow */
8485+
check_stack_depth();
8486+
84808487
if (!recursing)
84818488
addrs = new_object_addresses();
84828489

@@ -10939,6 +10946,9 @@ ATExecAlterConstrRecurse(Constraint *cmdcon, Relation conrel, Relation tgrel,
1093910946
Oidrefrelid;
1094010947
boolchanged = false;
1094110948

10949+
/* since this function recurses, it could be driven to stack overflow */
10950+
check_stack_depth();
10951+
1094210952
currcon = (Form_pg_constraint) GETSTRUCT(contuple);
1094310953
conoid = currcon->oid;
1094410954
refrelid = currcon->confrelid;
@@ -11955,6 +11965,9 @@ ATExecDropConstraint(Relation rel, const char *constrName,
1195511965
boolis_no_inherit_constraint = false;
1195611966
charcontype;
1195711967

11968+
/* since this function recurses, it could be driven to stack overflow */
11969+
check_stack_depth();
11970+
1195811971
/* At top level, permission check was done in ATPrepCmd, else do it */
1195911972
if (recursing)
1196011973
ATSimplePermissions(AT_DropConstraint, 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
@@ -2347,6 +2347,10 @@ static Node *
23472347
eval_const_expressions_mutator(Node*node,
23482348
eval_const_expressions_context*context)
23492349
{
2350+
2351+
/* since this function recurses, it could be driven to stack overflow */
2352+
check_stack_depth();
2353+
23502354
if (node==NULL)
23512355
returnNULL;
23522356
switch (nodeTag(node))

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,6 +1231,9 @@ executeBoolItem(JsonPathExecContext *cxt, JsonPathItem *jsp,
12311231
JsonPathBoolres;
12321232
JsonPathBoolres2;
12331233

1234+
/* since this function recurses, it could be driven to stack overflow */
1235+
check_stack_depth();
1236+
12341237
if (!canHaveNext&&jspHasNext(jsp))
12351238
elog(ERROR,"boolean jsonpath item cannot have next item");
12361239

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp