diff options
-rw-r--r-- | src/backend/regex/regc_nfa.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/backend/regex/regc_nfa.c b/src/backend/regex/regc_nfa.c index 1a6c9ce1838..69929eddfcc 100644 --- a/src/backend/regex/regc_nfa.c +++ b/src/backend/regex/regc_nfa.c @@ -3082,8 +3082,13 @@ checkmatchall_recurse(struct nfa *nfa, struct state *s, { /* We found an all-RAINBOW path to the post state */ result = true; + /* ... which should not be adjacent to the pre state */ + if (depth < 0) + { + NERR(REG_ASSERT); + return false; + } /* Record potential match lengths */ - assert(depth >= 0); hasmatch[depth] = true; if (foundloop) { |