summaryrefslogtreecommitdiff
path: root/contrib/ltree/ltxtquery_io.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:30 -0400
commit5976097c0fce03f8cc201aefc4445ad57e09bb75 (patch)
tree011ef8299f97ed7812358207b555abe564fedbe5 /contrib/ltree/ltxtquery_io.c
parent30cb12881de55bc91a2cbde29d836bd3332612c3 (diff)
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 'contrib/ltree/ltxtquery_io.c')
-rw-r--r--contrib/ltree/ltxtquery_io.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/contrib/ltree/ltxtquery_io.c b/contrib/ltree/ltxtquery_io.c
index ddc63d7b66b..74010f3cef4 100644
--- a/contrib/ltree/ltxtquery_io.c
+++ b/contrib/ltree/ltxtquery_io.c
@@ -416,6 +416,9 @@ while( ( (inf)->cur - (inf)->buf ) + (addsize) + 1 >= (inf)->buflen ) \
static void
infix(INFIX *in, bool first)
{
+ /* since this function recurses, it could be driven to stack overflow. */
+ check_stack_depth();
+
if (in->curpol->type == VAL)
{
char *op = in->op + in->curpol->distance;