Fix miscopmilation of conditionals when a group name start with "R"

This commit is contained in:
Petr Písař 2016-10-14 09:17:40 +02:00
parent 4b06e5c4e1
commit 36c95bef7f
2 changed files with 86 additions and 0 deletions

View File

@ -0,0 +1,80 @@
From a2d87770aebc2ba13d6943ff1fcfae0fc26a3134 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
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?!.)*/
+/(?<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 --/
--
2.7.4

View File

@ -50,6 +50,9 @@ Patch4: pcre-8.39-Fix-character-class-bug-when-a-Unicode-property-was-.patch
Patch5: pcre-8.39-Fix-pcretest-callout-display-bug.patch
# Fix pcrepattern(3) documentation, in upstream after 8.39
Patch6: pcre-8.39-Fix-typos-in-documentation.patch
# Fix miscopmilation of conditionals when a group name start with "R",
# in upstream after 8.39, upstream bug #1873
Patch7: pcre-8.39-Fix-bad-conditional-recursion-test-bug-when-a-group-.patch
BuildRequires: readline-devel
BuildRequires: autoconf
BuildRequires: automake
@ -144,6 +147,7 @@ Utilities demonstrating PCRE capabilities like pcregrep or pcretest.
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
# Because of rpath patch
libtoolize --copy --force
autoreconf -vif
@ -244,6 +248,8 @@ make %{?_smp_mflags} check VERBOSE=yes
- Fix displaying position in pcretest callout with an escape sequence greater
than \x{ff}
- Fix pcrepattern(3) documentation
- Fix miscopmilation of conditionals when a group name start with "R"
(upstream bug #1873)
* Tue Aug 30 2016 Petr Pisar <ppisar@redhat.com> - 8.39-3
- Fix register overwite in JIT when SSE2 acceleration is enabled