summaryrefslogtreecommitdiff
path: root/src/backend/nodes/equalfuncs.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
commite60122b54daf6f0e93162161b41ecb9ab4655fa5 (patch)
tree5db10e020194c4ec6108f2d44d0c1dbd146be086 /src/backend/nodes/equalfuncs.c
parent9eaba23c414d9da1e767e1af0a80cb687dc358e2 (diff)
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/equalfuncs.c')
-rw-r--r--src/backend/nodes/equalfuncs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c
index c5bb817ba19..c566eb9b257 100644
--- a/src/backend/nodes/equalfuncs.c
+++ b/src/backend/nodes/equalfuncs.c
@@ -29,6 +29,7 @@
#include "postgres.h"
+#include "miscadmin.h"
#include "nodes/extensible.h"
#include "nodes/relation.h"
#include "utils/datum.h"
@@ -2978,6 +2979,9 @@ equal(const void *a, const void *b)
if (nodeTag(a) != nodeTag(b))
return false;
+ /* Guard against stack overflow due to overly complex expressions */
+ check_stack_depth();
+
switch (nodeTag(a))
{
/*