aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils
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:35 -0400
commit879877b00bb54ba9dcdef0d218bd36c4e5404d6f (patch)
tree54cea9388658325b24a7e9727d1f69a63807843d /src/backend/utils
parent9581e2699f6379e29151b0bef04ca45a06f5afe0 (diff)
downloadpostgresql-879877b00bb54ba9dcdef0d218bd36c4e5404d6f.tar.gz
postgresql-879877b00bb54ba9dcdef0d218bd36c4e5404d6f.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')
-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 9feb4b796a6..dd48e85731d 100644
--- a/src/backend/utils/adt/tsquery_cleanup.c
+++ b/src/backend/utils/adt/tsquery_cleanup.c
@@ -34,6 +34,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)