diff options
author | Noah Misch <noah@leadboat.com> | 2015-10-05 10:06:30 -0400 |
---|---|---|
committer | Noah Misch <noah@leadboat.com> | 2015-10-05 10:06:30 -0400 |
commit | 5976097c0fce03f8cc201aefc4445ad57e09bb75 (patch) | |
tree | 011ef8299f97ed7812358207b555abe564fedbe5 /src/backend/utils/adt/tsquery_cleanup.c | |
parent | 30cb12881de55bc91a2cbde29d836bd3332612c3 (diff) | |
download | postgresql-5976097c0fce03f8cc201aefc4445ad57e09bb75.tar.gz postgresql-5976097c0fce03f8cc201aefc4445ad57e09bb75.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.c | 3 |
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 2545f4eea7c..b841006dd0f 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) |