aboutsummaryrefslogtreecommitdiff
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
commit552c310ba4ec072a2df48a08722f0af2e3703fdf (patch)
treea3dea17fe8d91570e5b1639f90202af51d1a5cc1 /src/backend/nodes/readfuncs.c
parent4d5cfb91156d1cc8ede245b8b363468efedf1975 (diff)
downloadpostgresql-552c310ba4ec072a2df48a08722f0af2e3703fdf.tar.gz
postgresql-552c310ba4ec072a2df48a08722f0af2e3703fdf.zip
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 32b23fff097..a285af302f8 100644
--- a/src/backend/nodes/readfuncs.c
+++ b/src/backend/nodes/readfuncs.c
@@ -28,6 +28,7 @@
#include <math.h>
+#include "miscadmin.h"
#include "nodes/parsenodes.h"
#include "nodes/readfuncs.h"
@@ -1382,6 +1383,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) \