From 0f9fd7419a19c3bfa000117d8b475e134824259a 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 da71dbb7332..0c8b258945b 100644 --- a/src/backend/nodes/readfuncs.c +++ b/src/backend/nodes/readfuncs.c @@ -29,6 +29,7 @@ #include #include "fmgr.h" +#include "miscadmin.h" #include "nodes/extensible.h" #include "nodes/parsenodes.h" #include "nodes/plannodes.h" @@ -2262,6 +2263,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