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
#include "postgres.h"
+#include "miscadmin.h"
#include "nodes/extensible.h"
#include "nodes/relation.h"
#include "utils/datum.h"
if (nodeTag(a) != nodeTag(b))
return false;
+ /* Guard against stack overflow due to overly complex expressions */
+ check_stack_depth();
+
switch (nodeTag(a))
{
/*
Plan *plan = planstate->plan;
ListCell *lc;
+ /* Guard against stack overflow due to overly complex plan trees */
+ check_stack_depth();
+
/* initPlan-s */
if (planstate_walk_subplans(planstate->initPlan, walker, context))
return true;
#include <ctype.h>
#include "lib/stringinfo.h"
+#include "miscadmin.h"
#include "nodes/extensible.h"
#include "nodes/plannodes.h"
#include "nodes/relation.h"
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))
#include <math.h>
#include "fmgr.h"
+#include "miscadmin.h"
#include "nodes/extensible.h"
#include "nodes/parsenodes.h"
#include "nodes/plannodes.h"
READ_TEMP_LOCALS();
+ /* Guard against stack overflow due to overly complex expressions */
+ check_stack_depth();
+
token = pg_strtok(&length);
#define MATCH(tokname, namelen) \