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

Commit84cc1a5

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 parent628c3f2 commit84cc1a5

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
@@ -71,6 +71,7 @@
7171
#include"commands/sequence.h"
7272
#include"commands/trigger.h"
7373
#include"commands/typecmds.h"
74+
#include"miscadmin.h"
7475
#include"nodes/nodeFuncs.h"
7576
#include"parser/parsetree.h"
7677
#include"rewrite/rewriteRemove.h"
@@ -508,6 +509,12 @@ findDependentObjects(const ObjectAddress *object,
508509
if (stack_address_present_add_flags(object,objflags,stack))
509510
return;
510511

512+
/*
513+
* since this function recurses, it could be driven to stack overflow,
514+
* because of the deep dependency tree, not only due to dependency loops.
515+
*/
516+
check_stack_depth();
517+
511518
/*
512519
* It's also possible that the target object has already been completely
513520
* 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
@@ -595,6 +595,9 @@ CheckAttributeType(const char *attname,
595595
charatt_typtype=get_typtype(atttypid);
596596
Oidatt_typelem;
597597

598+
/* since this function recurses, it could be driven to stack overflow */
599+
check_stack_depth();
600+
598601
if (att_typtype==TYPTYPE_PSEUDO)
599602
{
600603
/*

‎src/backend/commands/tablecmds.c

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

6570+
/* since this function recurses, it could be driven to stack overflow */
6571+
check_stack_depth();
6572+
65706573
/* At top level, permission check was done in ATPrepCmd, else do it */
65716574
if (recursing)
65726575
ATSimplePermissions(rel, ATT_TABLE | ATT_FOREIGN_TABLE);
@@ -8324,6 +8327,10 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName,
83248327

83258328
/* Initialize addrs on the first invocation */
83268329
Assert(!recursing || addrs != NULL);
8330+
8331+
/* since this function recurses, it could be driven to stack overflow */
8332+
check_stack_depth();
8333+
83278334
if (!recursing)
83288335
addrs = new_object_addresses();
83298336

@@ -10479,6 +10486,9 @@ ATExecAlterConstrRecurse(Constraint *cmdcon, Relation conrel, Relation tgrel,
1047910486
Oidrefrelid;
1048010487
boolchanged = false;
1048110488

10489+
/* since this function recurses, it could be driven to stack overflow */
10490+
check_stack_depth();
10491+
1048210492
currcon = (Form_pg_constraint) GETSTRUCT(contuple);
1048310493
conoid = currcon->oid;
1048410494
refrelid = currcon->confrelid;
@@ -11463,6 +11473,9 @@ ATExecDropConstraint(Relation rel, const char *constrName,
1146311473
boolis_no_inherit_constraint = false;
1146411474
charcontype;
1146511475

11476+
/* since this function recurses, it could be driven to stack overflow */
11477+
check_stack_depth();
11478+
1146611479
/* At top level, permission check was done in ATPrepCmd, else do it */
1146711480
if (recursing)
1146811481
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
@@ -2302,6 +2302,10 @@ static Node *
23022302
eval_const_expressions_mutator(Node*node,
23032303
eval_const_expressions_context*context)
23042304
{
2305+
2306+
/* since this function recurses, it could be driven to stack overflow */
2307+
check_stack_depth();
2308+
23052309
if (node==NULL)
23062310
returnNULL;
23072311
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