summaryrefslogtreecommitdiff
path: root/src/backend/nodes/readfuncs.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2018-12-10 11:12:43 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2018-12-10 11:12:43 -0500
commit001bb9f3ed05e7c370151f7aad3a83447c52c157 (patch)
treed411e21856e5caa9a8fd3fdfe3991f4ed9126f1f /src/backend/nodes/readfuncs.c
parente28649a67f56ee1f7c1a55dc3dee4a1e467430a4 (diff)
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 seems unwise. Likewise fix planstate_tree_walker(), in branches where that exists. Discussion: https://postgr.es/m/30253.1544286631@sss.pgh.pa.us
Diffstat (limited to 'src/backend/nodes/readfuncs.c')
-rw-r--r--src/backend/nodes/readfuncs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
index e117867de56..fa27f37d6f0 100644
--- a/src/backend/nodes/readfuncs.c
+++ b/src/backend/nodes/readfuncs.c
@@ -33,6 +33,7 @@
#include <math.h>
#include "fmgr.h"
+#include "miscadmin.h"
#include "nodes/extensible.h"
#include "nodes/parsenodes.h"
#include "nodes/plannodes.h"
@@ -2549,6 +2550,9 @@ parseNodeString(void)
READ_TEMP_LOCALS();
+ /* Guard against stack overflow due to overly complex expressions */
+ check_stack_depth();
+
token = pg_strtok(&length);
#define MATCH(tokname, namelen) \