diff options
author | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2016-10-13 16:00:48 +0000 |
---|---|---|
committer | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2016-10-13 16:00:48 +0000 |
commit | a2d87770aebc2ba13d6943ff1fcfae0fc26a3134 (patch) | |
tree | 86184f9e683f46bb8da21af6c1592b69ade2045a | |
parent | c53d4af2465bf11a8aefceb67bf7f7ae19b08ac5 (diff) | |
download | pcre-a2d87770aebc2ba13d6943ff1fcfae0fc26a3134.tar.gz |
Fix bad conditional recursion test bug when a group with name starting "R"
exists.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1667 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r-- | ChangeLog | 26 | ||||
-rw-r--r-- | pcre_compile.c | 3 | ||||
-rw-r--r-- | testdata/testinput2 | 4 | ||||
-rw-r--r-- | testdata/testoutput2 | 28 |
4 files changed, 51 insertions, 10 deletions
@@ -19,15 +19,23 @@ Version 8.40 xx-xxxx-2016 5. Fix JIT unaligned accesses on x86. Patch by Marc Mutz. -6. In any wide-character mode (8-bit UTF or any 16-bit or 32-bit mode), without - PCRE_UCP set, a negative character type such as \D in a positive class - should cause all characters greater than 255 to match, whatever else is in - the class. There was a bug that caused this not to happen if a Unicode - property item was added to such a class, for example [\D\P{Nd}] or [\W\pL]. - -7. When pcretest was outputing information from a callout, the caret indicator - for the current position in the subject line was incorrect if it was after - an escape sequence for a character whose code point was greater than \x{ff}. +6. In any wide-character mode (8-bit UTF or any 16-bit or 32-bit mode), + without PCRE_UCP set, a negative character type such as \D in a positive + class should cause all characters greater than 255 to match, whatever else + is in the class. There was a bug that caused this not to happen if a + Unicode property item was added to such a class, for example [\D\P{Nd}] or + [\W\pL]. + +7. When pcretest was outputing information from a callout, the caret indicator + for the current position in the subject line was incorrect if it was after + an escape sequence for a character whose code point was greater than + \x{ff}. + +8. A pattern such as (?<RA>abc)(?(R)xyz) was incorrectly compiled such that + the conditional was interpreted as a reference to capturing group 1 instead + of a test for recursion. Any group whose name began with R was + misinterpreted in this way. (The reference interpretation should only + happen if the group's name is precisely "R".) Version 8.39 14-June-2016 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?!.)*/ +/(?<RA>abc)(?(R)xyz)/BZ + +/(?<R>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 +/(?<RA>abc)(?(R)xyz)/BZ +------------------------------------------------------------------ + Bra + CBra 1 + abc + Ket + Cond + Cond recurse any + xyz + Ket + Ket + End +------------------------------------------------------------------ + +/(?<R>abc)(?(R)xyz)/BZ +------------------------------------------------------------------ + Bra + CBra 1 + abc + Ket + Cond + 1 Cond ref + xyz + Ket + Ket + End +------------------------------------------------------------------ + /-- End of testinput2 --/ |