diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/tsearch/wparser_def.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/backend/tsearch/wparser_def.c b/src/backend/tsearch/wparser_def.c index 7fd3a20400e..f307fd1e17b 100644 --- a/src/backend/tsearch/wparser_def.c +++ b/src/backend/tsearch/wparser_def.c @@ -18,6 +18,7 @@ #include "catalog/pg_collation.h" #include "commands/defrem.h" +#include "miscadmin.h" #include "tsearch/ts_locale.h" #include "tsearch/ts_public.h" #include "tsearch/ts_type.h" @@ -639,6 +640,12 @@ p_ishost(TParser *prs) tmpprs->wanthost = true; + /* + * Check stack depth before recursing. (Since TParserGet() doesn't + * normally recurse, we put the cost of checking here not there.) + */ + check_stack_depth(); + if (TParserGet(tmpprs) && tmpprs->type == HOST) { prs->state->posbyte += tmpprs->lenbytetoken; @@ -662,6 +669,12 @@ p_isURLPath(TParser *prs) tmpprs->state = newTParserPosition(tmpprs->state); tmpprs->state->state = TPS_InURLPathFirst; + /* + * Check stack depth before recursing. (Since TParserGet() doesn't + * normally recurse, we put the cost of checking here not there.) + */ + check_stack_depth(); + if (TParserGet(tmpprs) && tmpprs->type == URLPATH) { prs->state->posbyte += tmpprs->lenbytetoken; @@ -1705,6 +1718,8 @@ TParserGet(TParser *prs) { const TParserStateActionItem *item = NULL; + CHECK_FOR_INTERRUPTS(); + Assert(prs->state); if (prs->state->posbyte >= prs->lenstr) |