From 552c310ba4ec072a2df48a08722f0af2e3703fdf Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 10 Dec 2018 11:12:43 -0500 Subject: 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 --- src/backend/nodes/readfuncs.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/backend/nodes/readfuncs.c') 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 +#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) \ -- cgit v1.2.3