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:35 -0400
commitea68c221f4d2351e111ff3d7573ef67a0e9c855a (patch)
tree3cdc4f9a2e01c3ab62700e415b9869167211fd3e /src/backend/utils/adt/tsquery_cleanup.c
parent5e43130b50be8d0115b1ce083595f9252097369f (diff)
downloadpostgresql-ea68c221f4d2351e111ff3d7573ef67a0e9c855a.tar.gz
postgresql-ea68c221f4d2351e111ff3d7573ef67a0e9c855a.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 054b529845a..5a95f371c9a 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)