]> granicus.if.org Git - postgresql/commit
Fix infinite-loop risk in fixempties() stage of regex compilation.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 7 Mar 2013 16:51:25 +0000 (11:51 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 7 Mar 2013 16:51:25 +0000 (11:51 -0500)
commitf85e3f37625745bee9df9e9a4cc809f64fec9828
tree8f736357c5a3a4edc9ad33baaea36e08d8ed3380
parent7140cef24064ea43e1b6de2c5d45b5c0d95d5e16
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
src/backend/regex/regc_nfa.c
src/backend/regex/regcomp.c