From e60122b54daf6f0e93162161b41ecb9ab4655fa5 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/outfuncs.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/backend/nodes/outfuncs.c') diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index 95d6abb93e6..ec4d4b220cd 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -30,6 +30,7 @@ #include #include "lib/stringinfo.h" +#include "miscadmin.h" #include "nodes/extensible.h" #include "nodes/plannodes.h" #include "nodes/relation.h" @@ -3615,6 +3616,9 @@ _outPartitionRangeDatum(StringInfo str, const PartitionRangeDatum *node) void outNode(StringInfo str, const void *obj) { + /* Guard against stack overflow due to overly complex expressions */ + check_stack_depth(); + if (obj == NULL) appendStringInfoString(str, "<>"); else if (IsA(obj, List) ||IsA(obj, IntList) || IsA(obj, OidList)) -- cgit v1.2.3