Fix infinite-loop risk in fixempties() stage of regex compilation.
The previous coding of this function could get into situations where it would never terminate, because successive passes would re-add EMPTY arcs that had been removed by the previous pass. Rewrite the function completely using a new algorithm that is guaranteed to terminate, and also seems to be usually faster than the old one. Per Tcl bugs 3604074 and 3606683. Tom Lane and Don Porter
Showing
- src/backend/regex/regc_nfa.c 245 additions, 69 deletionssrc/backend/regex/regc_nfa.c
- src/backend/regex/regcomp.c 8 additions, 4 deletionssrc/backend/regex/regcomp.c
- src/test/regress/expected/regex.out 20 additions, 0 deletionssrc/test/regress/expected/regex.out
- src/test/regress/sql/regex.sql 7 additions, 0 deletionssrc/test/regress/sql/regex.sql
Loading
Please register or sign in to comment