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

Commit001bb9f

Browse files
committed
Add stack depth checks to key recursive functions in backend/nodes/*.c.
Although copyfuncs.c has a check_stack_depth call in its recursion,equalfuncs.c, outfuncs.c, and readfuncs.c lacked one. This seemsunwise.Likewise fix planstate_tree_walker(), in branches where that exists.Discussion:https://postgr.es/m/30253.1544286631@sss.pgh.pa.us
1 parente28649a commit001bb9f

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

‎src/backend/nodes/equalfuncs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
#include"postgres.h"
3131

32+
#include"miscadmin.h"
3233
#include"nodes/extensible.h"
3334
#include"nodes/relation.h"
3435
#include"utils/datum.h"
@@ -3002,6 +3003,9 @@ equal(const void *a, const void *b)
30023003
if (nodeTag(a)!=nodeTag(b))
30033004
return false;
30043005

3006+
/* Guard against stack overflow due to overly complex expressions */
3007+
check_stack_depth();
3008+
30053009
switch (nodeTag(a))
30063010
{
30073011
/*

‎src/backend/nodes/nodeFuncs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3726,6 +3726,9 @@ planstate_tree_walker(PlanState *planstate,
37263726
Plan*plan=planstate->plan;
37273727
ListCell*lc;
37283728

3729+
/* Guard against stack overflow due to overly complex plan trees */
3730+
check_stack_depth();
3731+
37293732
/* initPlan-s */
37303733
if (planstate_walk_subplans(planstate->initPlan,walker,context))
37313734
return true;

‎src/backend/nodes/outfuncs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include<ctype.h>
3131

3232
#include"lib/stringinfo.h"
33+
#include"miscadmin.h"
3334
#include"nodes/extensible.h"
3435
#include"nodes/plannodes.h"
3536
#include"nodes/relation.h"
@@ -3701,6 +3702,9 @@ _outPartitionRangeDatum(StringInfo str, const PartitionRangeDatum *node)
37013702
void
37023703
outNode(StringInfostr,constvoid*obj)
37033704
{
3705+
/* Guard against stack overflow due to overly complex expressions */
3706+
check_stack_depth();
3707+
37043708
if (obj==NULL)
37053709
appendStringInfoString(str,"<>");
37063710
elseif (IsA(obj,List)||IsA(obj,IntList)||IsA(obj,OidList))

‎src/backend/nodes/readfuncs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include<math.h>
3434

3535
#include"fmgr.h"
36+
#include"miscadmin.h"
3637
#include"nodes/extensible.h"
3738
#include"nodes/parsenodes.h"
3839
#include"nodes/plannodes.h"
@@ -2549,6 +2550,9 @@ parseNodeString(void)
25492550

25502551
READ_TEMP_LOCALS();
25512552

2553+
/* Guard against stack overflow due to overly complex expressions */
2554+
check_stack_depth();
2555+
25522556
token=pg_strtok(&length);
25532557

25542558
#defineMATCH(tokname,namelen) \

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp