aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/tsquery_cleanup.c
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2015-10-05 10:06:30 -0400
committerNoah Misch <noah@leadboat.com>2015-10-05 10:06:34 -0400
commitbed3f6d0354a7ca2fcd7d088ff271b422dbf9921 (patch)
tree1b1a0b14590eb9ee85894bea8a2c343ed147fe90 /src/backend/utils/adt/tsquery_cleanup.c
parenta0c02ed5b4ef24d91a6fb22d447fc5cba8aeb146 (diff)
downloadpostgresql-bed3f6d0354a7ca2fcd7d088ff271b422dbf9921.tar.gz
postgresql-bed3f6d0354a7ca2fcd7d088ff271b422dbf9921.zip
Prevent stack overflow in query-type functions.
The tsquery, ltxtquery and query_int data types have a common ancestor. Having acquired check_stack_depth() calls independently, each was missing at least one call. Back-patch to 9.0 (all supported versions).
Diffstat (limited to 'src/backend/utils/adt/tsquery_cleanup.c')
-rw-r--r--src/backend/utils/adt/tsquery_cleanup.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/backend/utils/adt/tsquery_cleanup.c b/src/backend/utils/adt/tsquery_cleanup.c
index e96851207f6..8b1f3360eb9 100644
--- a/src/backend/utils/adt/tsquery_cleanup.c
+++ b/src/backend/utils/adt/tsquery_cleanup.c
@@ -33,6 +33,9 @@ maketree(QueryItem *in)
{
NODE *node = (NODE *) palloc(sizeof(NODE));
+ /* since this function recurses, it could be driven to stack overflow. */
+ check_stack_depth();
+
node->valnode = in;
node->right = node->left = NULL;
if (in->type == QI_OPR)