On Mon, 5 Sep 2011, ND wrote:
> PCRE version 8.13 2011-08-16
> /(?>(?&t)c|(?&t))(?(DEFINE)(?<t>a|b(*PRUNE)c))/s
> ba
> Error -26 (nested recursion at the same subject position)
>
>
> if subject string is "bba" then pcretest is freezed without answer (may be
> infinite loop?)
You are very good at finding obscure bugs. The patch below fixes this.
Philip
--
Philip Hazel
--- pcre-8.13/pcre_exec.c 2011-08-02 11:59:47.000000000 +0100
+++ pcre_exec.c 2011-09-06 10:18:59.000000000 +0100
@@ -1556,10 +1556,10 @@
md, eptrb, RM6);
memcpy(md->offset_vector, new_recursive.offset_save,
new_recursive.saved_max * sizeof(int));
+ md->recursive = new_recursive.prevrec;
if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT)
{
DPRINTF(("Recursion matched\n"));
- md->recursive = new_recursive.prevrec;
if (new_recursive.offset_save != stacksave)
(pcre_free)(new_recursive.offset_save);