From a2d87770aebc2ba13d6943ff1fcfae0fc26a3134 Mon Sep 17 00:00:00 2001 From: ph10 Date: Thu, 13 Oct 2016 16:00:48 +0000 Subject: [PATCH] Fix bad conditional recursion test bug when a group with name starting "R" exists. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1667 2f5784b3-3f2a-0410-8824-cb99058d5e15 Petr Písař: Ported to 8.39. diff --git a/pcre_compile.c b/pcre_compile.c index fb80ed1..67c74e8 100644 --- a/pcre_compile.c +++ b/pcre_compile.c @@ -6951,7 +6951,8 @@ for (;; ptr++) slot = cd->name_table; for (i = 0; i < cd->names_found; i++) { - if (STRNCMP_UC_UC(name, slot+IMM2_SIZE, namelen) == 0) break; + if (STRNCMP_UC_UC(name, slot+IMM2_SIZE, namelen) == 0 && + slot[IMM2_SIZE+namelen] == 0) break; slot += cd->name_entry_size; } diff --git a/testdata/testinput2 b/testdata/testinput2 index 75e402e..38346ef 100644 --- a/testdata/testinput2 +++ b/testdata/testinput2 @@ -4243,4 +4243,8 @@ backtracking verbs. --/ /\N(?(?C)0?!.)*/ +/(?abc)(?(R)xyz)/BZ + +/(?abc)(?(R)xyz)/BZ + /-- End of testinput2 --/ diff --git a/testdata/testoutput2 b/testdata/testoutput2 index 5e88d1a..216bff8 100644 --- a/testdata/testoutput2 +++ b/testdata/testoutput2 @@ -14670,4 +14670,32 @@ No match /\N(?(?C)0?!.)*/ Failed: assertion expected after (?( or (?(?C) at offset 4 +/(?abc)(?(R)xyz)/BZ +------------------------------------------------------------------ + Bra + CBra 1 + abc + Ket + Cond + Cond recurse any + xyz + Ket + Ket + End +------------------------------------------------------------------ + +/(?abc)(?(R)xyz)/BZ +------------------------------------------------------------------ + Bra + CBra 1 + abc + Ket + Cond + 1 Cond ref + xyz + Ket + Ket + End +------------------------------------------------------------------ + /-- End of testinput2 --/ -- 2.7.4