Rather than enforcing an exact string match, the code would effectively accept any string that satisfies the pattern sub-expression referenced by the back-reference symbol.
A similar problem still afflicts back-references that are embedded in a larger quantified expression, rather than being the immediate subject of the quantifier. This will be addressed in a future PostgreSQL release.
2. 9-1-5
Fix extraction of common prefixes from regular expressions (Tom Lane)
The code could get confused by quantified parenthesized subexpressions, such as ^(foo)?bar. This would lead to incorrect index optimization of searches for such patterns.
3. 9-2
Sync regular expression code with TCL 8.5.11 and improve internal processing (Tom Lane)
TCL 8.5 x86_64 (Windows 7) — баг воспроизводится.
Спасибо, буду знать. К счастью, в боевом проекте регулярки на основе пользовательского ввода не строятся.
Люди, за что минусуем то: человек просто проверил и сообщил. Я то же не знаю, где еще используется это NFA решение. Чисто теоретически могло быть и в php.
9.1.8 на FreeBSD 8.3 amd64 — воспроизводится.
Рестарт зависшего процесса только жесткий — вместе со всем постгресом :(
Ждем фикса, а пока поставил простую проверку в местах где используется Regexp.
PostgreSQL, TCL и другие: Критическая ошибка в RE engine. Возможная уязвимость