diff options
Diffstat (limited to 'src/backend/regex/regc_nfa.c')
-rw-r--r-- | src/backend/regex/regc_nfa.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/backend/regex/regc_nfa.c b/src/backend/regex/regc_nfa.c index ae2dbe43fe8..f6dad013b54 100644 --- a/src/backend/regex/regc_nfa.c +++ b/src/backend/regex/regc_nfa.c @@ -174,11 +174,23 @@ newstate(struct nfa * nfa) { struct state *s; + /* + * This is a handy place to check for operation cancel during regex + * compilation, since no code path will go very long without making a new + * state. + */ + if (CANCEL_REQUESTED(nfa->v->re)) + { + NERR(REG_CANCEL); + return NULL; + } + if (TooManyStates(nfa)) { NERR(REG_ETOOBIG); return NULL; } + if (nfa->free != NULL) { s = nfa->free; |