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

This commit is contained in:
Petr Písař 2016-10-19 13:09:09 +02:00
parent b7ceedada0
commit 98c96fae6e
3 changed files with 126 additions and 0 deletions

View File

@ -0,0 +1,73 @@
From 4fb3fa035510f780258a1d3e3e1315039038e1df Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Thu, 13 Oct 2016 16:08:08 +0000
Subject: [PATCH] Add test for bug already fixed by the refactoring.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@564 6239d852-aaf2-0410-a92c-79f79f948069
Petr Písař: Ported to 10.22.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
testdata/testinput2 | 4 ++++
testdata/testoutput2 | 28 ++++++++++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/testdata/testinput2 b/testdata/testinput2
index 9d0759f..2d4bbe5 100644
--- a/testdata/testinput2
+++ b/testdata/testinput2
@@ -4819,4 +4819,8 @@ a)"xI
/\[AB]{6000000000000000000000}/expand
+/(?<RA>abc)(?(R)xyz)/B
+
+/(?<R>abc)(?(R)xyz)/B
+
# End of testinput2
diff --git a/testdata/testoutput2 b/testdata/testoutput2
index 01cb193..ef7e329 100644
--- a/testdata/testoutput2
+++ b/testdata/testoutput2
@@ -15195,6 +15195,34 @@ No match
/\[AB]{6000000000000000000000}/expand
** Pattern repeat count too large
+/(?<RA>abc)(?(R)xyz)/B
+------------------------------------------------------------------
+ Bra
+ CBra 1
+ abc
+ Ket
+ Cond
+ Cond recurse any
+ xyz
+ Ket
+ Ket
+ End
+------------------------------------------------------------------
+
+/(?<R>abc)(?(R)xyz)/B
+------------------------------------------------------------------
+ Bra
+ CBra 1
+ abc
+ Ket
+ Cond
+ 1 Cond ref
+ xyz
+ Ket
+ Ket
+ End
+------------------------------------------------------------------
+
# End of testinput2
Error -63: PCRE2_ERROR_BADDATA (unknown error number)
Error -62: bad serialized data
--
2.7.4

View File

@ -0,0 +1,43 @@
From 8b294ce0b5269e2e2c110ac502e8c4e8f00dbd75 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 19 Oct 2016 13:05:57 +0200
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
pcre commit ported to pcre2-10.22:
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
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
src/pcre2_compile.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c
index a92a69a..b3ebb25 100644
--- a/src/pcre2_compile.c
+++ b/src/pcre2_compile.c
@@ -6378,7 +6378,8 @@ for (;; ptr++)
slot = cb->name_table;
for (i = 0; i < cb->names_found; i++)
{
- if (PRIV(strncmp)(name, slot+IMM2_SIZE, namelen) == 0) break;
+ if (PRIV(strncmp)(name, slot+IMM2_SIZE, namelen) == 0 &&
+ slot[IMM2_SIZE+namelen] == 0) break;
slot += cb->name_entry_size;
}
--
2.7.4

View File

@ -34,6 +34,12 @@ Patch2: pcre2-10.22-Fix-callout-display-bug-in-pcre2test.patch
Patch3: pcre2-10.22-Fix-typos-in-documentation.patch Patch3: pcre2-10.22-Fix-typos-in-documentation.patch
# 2/2 Fix pcrepattern(3) documentation, in upstream after 10.22 # 2/2 Fix pcrepattern(3) documentation, in upstream after 10.22
Patch4: pcre2-10.22-Missed-typo-fixed.patch Patch4: pcre2-10.22-Missed-typo-fixed.patch
# 1/2 Fix miscopmilation of conditionals when a group name start with "R",
# fixed in upstream after 10.22 by code refactoring, upstream bug #1873
Patch5: pcre2-10.22-Fix-bad-conditional-recursion-test-bug-when-a-group-.patch
# 2/2 Tests for Fix-bad-conditional-recursion-test-bug-when-a-group-.patch,
# in upstream after 10.22, upstream bug #1873
Patch6: pcre2-10.22-Add-test-for-bug-already-fixed-by-the-refactoring.patch
# New libtool to get rid of RPATH and to use distribution autotools # New libtool to get rid of RPATH and to use distribution autotools
BuildRequires: autoconf BuildRequires: autoconf
BuildRequires: automake BuildRequires: automake
@ -115,6 +121,8 @@ Utilities demonstrating PCRE2 capabilities like pcre2grep or pcre2test.
%patch2 -p1 %patch2 -p1
%patch3 -p1 %patch3 -p1
%patch4 -p1 %patch4 -p1
%patch5 -p1
%patch6 -p1
# Because of multilib patch # Because of multilib patch
libtoolize --copy --force libtoolize --copy --force
autoreconf -vif autoreconf -vif
@ -215,6 +223,8 @@ make %{?_smp_mflags} check VERBOSE=yes
- Fix displaying a callout position in pcretest output with an escape sequence - Fix displaying a callout position in pcretest output with an escape sequence
greater than \x{ff} greater than \x{ff}
- Fix pcrepattern(3) documentation - Fix pcrepattern(3) documentation
- Fix miscopmilation of conditionals when a group name start with "R"
(upstream bug #1873)
* Mon Aug 29 2016 Petr Pisar <ppisar@redhat.com> - 10.22-2 * Mon Aug 29 2016 Petr Pisar <ppisar@redhat.com> - 10.22-2
- Fix matching characters above 255 when a negative character type was used - Fix matching characters above 255 when a negative character type was used