10.23-RC1 bump

This commit is contained in:
Petr Písař 2017-01-17 10:26:38 +01:00
parent 140c94209c
commit 65d7ed9b4a
23 changed files with 74 additions and 2035 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@
/pcre2-10.21.tar.bz2
/pcre2-10.22-RC1.tar.bz2
/pcre2-10.22.tar.bz2
/pcre2-10.23-RC1.tar.bz2

View File

@ -1,73 +0,0 @@
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

@ -1,122 +0,0 @@
From 2ea592a6f17c9e94810181aa9e41401956fedf87 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Tue, 22 Nov 2016 10:18:08 +0000
Subject: [PATCH] Correct libpcre2posix typos (should be libpcre2-posix).
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Petr Pisar: Ported to 10.22:
commit c7235e18071f76478fc33d9b78ea97525da48e59
Author: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Tue Nov 22 10:18:08 2016 +0000
Correct libpcre2posix typos (should be libpcre2-posix).
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@602 6239d852-aaf2-0410-a92c-
79f79f948069
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
CMakeLists.txt | 16 ++++++++--------
README | 8 ++++----
pcre2-config.in | 2 +-
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ced3df2..af6e107 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -505,18 +505,18 @@ ADD_LIBRARY(pcre2-8 ${PCRE2_HEADERS} ${PCRE2_SOURCES} ${PROJECT_BINARY_DIR}/conf
SET_PROPERTY(TARGET pcre2-8
PROPERTY COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=8)
SET(targets ${targets} pcre2-8)
-ADD_LIBRARY(pcre2posix ${PCRE2POSIX_HEADERS} ${PCRE2POSIX_SOURCES})
-SET_PROPERTY(TARGET pcre2posix
+ADD_LIBRARY(pcre2-posix ${PCRE2POSIX_HEADERS} ${PCRE2POSIX_SOURCES})
+SET_PROPERTY(TARGET pcre2-posix
PROPERTY COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=8)
-SET(targets ${targets} pcre2posix)
-TARGET_LINK_LIBRARIES(pcre2posix pcre2-8)
+SET(targets ${targets} pcre2-posix)
+TARGET_LINK_LIBRARIES(pcre2-posix pcre2-8)
IF(MINGW AND NOT PCRE2_STATIC)
IF(NON_STANDARD_LIB_PREFIX)
- SET_TARGET_PROPERTIES(pcre2-8 pcre2posix PROPERTIES PREFIX "")
+ SET_TARGET_PROPERTIES(pcre2-8 pcre2-posix PROPERTIES PREFIX "")
ENDIF(NON_STANDARD_LIB_PREFIX)
IF(NON_STANDARD_LIB_SUFFIX)
- SET_TARGET_PROPERTIES(pcre2-8 pcre2posix PROPERTIES SUFFIX "-0.dll")
+ SET_TARGET_PROPERTIES(pcre2-8 pcre2-posix PROPERTIES SUFFIX "-0.dll")
ENDIF(NON_STANDARD_LIB_SUFFIX)
ENDIF(MINGW AND NOT PCRE2_STATIC)
ENDIF(PCRE2_BUILD_PCRE2_8)
@@ -564,7 +564,7 @@ IF(PCRE2_BUILD_PCRE2GREP)
SET_PROPERTY(TARGET pcre2grep
PROPERTY COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=8)
SET(targets ${targets} pcre2grep)
- TARGET_LINK_LIBRARIES(pcre2grep pcre2posix ${PCRE2GREP_LIBS})
+ TARGET_LINK_LIBRARIES(pcre2grep pcre2-posix ${PCRE2GREP_LIBS})
ENDIF(PCRE2_BUILD_PCRE2GREP)
# Testing
@@ -577,7 +577,7 @@ IF(PCRE2_BUILD_TESTS)
ADD_EXECUTABLE(pcre2test ${PCRE2TEST_SOURCES})
SET(targets ${targets} pcre2test)
IF(PCRE2_BUILD_PCRE2_8)
- LIST(APPEND PCRE2TEST_LIBS pcre2posix pcre2-8)
+ LIST(APPEND PCRE2TEST_LIBS pcre2-posix pcre2-8)
ENDIF(PCRE2_BUILD_PCRE2_8)
IF(PCRE2_BUILD_PCRE2_16)
LIST(APPEND PCRE2TEST_LIBS pcre2-16)
diff --git a/README b/README
index 03d67f6..1dd6a24 100644
--- a/README
+++ b/README
@@ -44,7 +44,7 @@ wrappers.
The distribution does contain a set of C wrapper functions for the 8-bit
library that are based on the POSIX regular expression API (see the pcre2posix
-man page). These can be found in a library called libpcre2posix. Note that this
+man page). These can be found in a library called libpcre2-posix. Note that this
just provides a POSIX calling interface to PCRE2; the regular expressions
themselves still follow Perl syntax and semantics. The POSIX API is restricted,
and does not give full access to all of PCRE2's facilities.
@@ -58,8 +58,8 @@ renamed or pointed at by a link.
If you are using the POSIX interface to PCRE2 and there is already a POSIX
regex library installed on your system, as well as worrying about the regex.h
header file (as mentioned above), you must also take care when linking programs
-to ensure that they link with PCRE2's libpcre2posix library. Otherwise they may
-pick up the POSIX functions of the same name from the other library.
+to ensure that they link with PCRE2's libpcre2-posix library. Otherwise they
+may pick up the POSIX functions of the same name from the other library.
One way of avoiding this confusion is to compile PCRE2 with the addition of
-Dregcomp=PCRE2regcomp (and similarly for the other POSIX functions) to the
@@ -814,7 +814,7 @@ The distribution should contain the files listed below.
libpcre2-8.pc.in template for libpcre2-8.pc for pkg-config
libpcre2-16.pc.in template for libpcre2-16.pc for pkg-config
libpcre2-32.pc.in template for libpcre2-32.pc for pkg-config
- libpcre2posix.pc.in template for libpcre2posix.pc for pkg-config
+ libpcre2-posix.pc.in template for libpcre2-posix.pc for pkg-config
ltmain.sh file used to build a libtool script
missing ) common stub for a few missing GNU programs while
) installing, generated by automake
diff --git a/pcre2-config.in b/pcre2-config.in
index dbef5e5..dcc1095 100644
--- a/pcre2-config.in
+++ b/pcre2-config.in
@@ -74,7 +74,7 @@ while test $# -gt 0; do
;;
--libs-posix)
if test @enable_pcre2_8@ = yes ; then
- echo $libS$libR -lpcre2posix -lpcre2-8
+ echo $libS$libR -lpcre2-posix -lpcre2-8
else
echo "${usage}" 1>&2
fi
--
2.7.4

View File

@ -1,38 +0,0 @@
From 3e67484ef38a7c13619ea44f18047644d8f49dca Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Sun, 23 Oct 2016 15:43:42 +0000
Subject: [PATCH] Document current assert capture limitation.
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@575 6239d852-aaf2-0410-a92c-79f79f948069
Petr Písař: Ported to 10.22.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
doc/pcre2pattern.3 | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/doc/pcre2pattern.3 b/doc/pcre2pattern.3
index 57b0014..3ca1088 100644
--- a/doc/pcre2pattern.3
+++ b/doc/pcre2pattern.3
@@ -2219,6 +2219,13 @@ numbering the capturing subpatterns in the whole pattern. However, substring
capturing is carried out only for positive assertions. (Perl sometimes, but not
always, does do capturing in negative assertions.)
.P
+WARNING: If a positive assertion containing one or more capturing subpatterns
+succeeds, but failure to match later in the pattern causes backtracking over
+this assertion, the captures within the assertion are reset only if no higher
+numbered captures are already set. This is, unfortunately, a fundamental
+limitation of the current implementation; it may get removed in a future
+reworking.
+.P
For compatibility with Perl, most assertion subpatterns may be repeated; though
it makes no sense to assert the same thing several times, the side effect of
capturing parentheses may occasionally be useful. However, an assertion that
--
2.7.4

View File

@ -1,83 +0,0 @@
From d8fd0a6ed323e5abaaa7e8f26ed1f74ab3a54007 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Fri, 9 Dec 2016 16:57:51 +0000
Subject: [PATCH] Fix NULL defer in extended substition for \p, \P, or \X.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Petr Pisar: Ported to 10.22:
commit 83a8a8c6d01e4a39830704a4270821b390f20488
Author: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Fri Dec 9 16:57:51 2016 +0000
Fix NULL defer in extended substition for \p, \P, or \X.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@615 6239d852-aaf2-0410-a92c-79f79f948069
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
src/pcre2_compile.c | 10 +++++-----
testdata/testinput2 | 3 +++
testdata/testoutput2 | 4 ++++
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c
index ed81639..ae6b5e1 100644
--- a/src/pcre2_compile.c
+++ b/src/pcre2_compile.c
@@ -1793,10 +1793,10 @@ entry, ptr is pointing at the \. On exit, it points the final code unit of the
escape sequence.
This function is also called from pcre2_substitute() to handle escape sequences
-in replacement strings. In this case, the cb argument is NULL, and only
-sequences that define a data character are recognised. The isclass argument is
-not relevant, but the options argument is the final value of the compiled
-pattern's options.
+in replacement strings. In this case, the cb argument is NULL, and in the case
+of escapes that have further processing, only sequences that define a data
+character are recognised. The isclass argument is not relevant; the options
+argument is the final value of the compiled pattern's options.
There is one "trick" case: when a sequence such as [[:>:]] or \s in UCP mode is
processed, it is replaced by a nested alternative sequence. If this contains a
@@ -1858,7 +1858,7 @@ else if ((i = escapes[c - ESCAPES_FIRST]) != 0)
if (i > 0) c = (uint32_t)i; else /* Positive is a data character */
{
escape = -i; /* Else return a special escape */
- if (escape == ESC_P || escape == ESC_p || escape == ESC_X)
+ if (cb != NULL && (escape == ESC_P || escape == ESC_p || escape == ESC_X))
cb->external_flags |= PCRE2_HASBKPORX; /* Note \P, \p, or \X */
}
}
diff --git a/testdata/testinput2 b/testdata/testinput2
index 3218cfe..a7c1ab3 100644
--- a/testdata/testinput2
+++ b/testdata/testinput2
@@ -4828,4 +4828,7 @@ a)"xI
/./newline=crlf
\=ph
+/(\x0e00\000000\xc)/replace=\P,substitute_extended
+\x0e00\000000\xc
+
# End of testinput2
diff --git a/testdata/testoutput2 b/testdata/testoutput2
index 1776d0d..9c478bb 100644
--- a/testdata/testoutput2
+++ b/testdata/testoutput2
@@ -15231,6 +15231,10 @@ Subject length lower bound = 0
\=ph
No match
+/(\x0e00\000000\xc)/replace=\P,substitute_extended
+\x0e00\000000\xc
+Failed: error -57 at offset 2 in replacement: bad escape sequence in replacement string
+
# End of testinput2
Error -63: PCRE2_ERROR_BADDATA (unknown error number)
Error -62: bad serialized data
--
2.7.4

View File

@ -1,73 +0,0 @@
From 3f4e0af094ac3d6facb7b8e581ba4bdf47d7d45d Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Fri, 9 Dec 2016 18:19:38 +0000
Subject: [PATCH] Fix OOB error in substitute with start offset longer than
length.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Petr Pisar: Port to 10.22:
commit a27071aeed86de6febe845edb6c7376faa2176ba
Author: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Fri Dec 9 18:19:38 2016 +0000
Fix OOB error in substitute with start offset longer than length.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@616 6239d852-aaf2-0410-a92c-79f79f948069
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
src/pcre2_substitute.c | 6 ++++++
testdata/testinput2 | 3 +++
testdata/testoutput2 | 4 ++++
3 files changed, 13 insertions(+)
diff --git a/src/pcre2_substitute.c b/src/pcre2_substitute.c
index 0bf781e..2467d16 100644
--- a/src/pcre2_substitute.c
+++ b/src/pcre2_substitute.c
@@ -287,6 +287,12 @@ options &= ~SUBSTITUTE_OPTIONS;
/* Copy up to the start offset */
+if (start_offset > length)
+ {
+ match_data->leftchar = 0;
+ rc = PCRE2_ERROR_BADOFFSET;
+ goto EXIT;
+ }
CHECKMEMCPY(subject, start_offset);
/* Loop for global substituting. */
diff --git a/testdata/testinput2 b/testdata/testinput2
index a7c1ab3..e2865b2 100644
--- a/testdata/testinput2
+++ b/testdata/testinput2
@@ -4831,4 +4831,7 @@ a)"xI
/(\x0e00\000000\xc)/replace=\P,substitute_extended
\x0e00\000000\xc
+//replace=0
+\=offset=7
+
# End of testinput2
diff --git a/testdata/testoutput2 b/testdata/testoutput2
index 9c478bb..29de949 100644
--- a/testdata/testoutput2
+++ b/testdata/testoutput2
@@ -15235,6 +15235,10 @@ No match
\x0e00\000000\xc
Failed: error -57 at offset 2 in replacement: bad escape sequence in replacement string
+//replace=0
+\=offset=7
+Failed: error -33: bad offset value
+
# End of testinput2
Error -63: PCRE2_ERROR_BADDATA (unknown error number)
Error -62: bad serialized data
--
2.7.4

View File

@ -1,145 +0,0 @@
From 2b029aba91d42edb9dd958306a7909e2bb459b01 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Tue, 1 Nov 2016 15:58:28 +0000
Subject: [PATCH] Fix auto-anchor bug when .* is inside an assertion.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Ported to 10.22:
commit 6fba816130cccd2158dc9a6d30b03bb2bb31ef8c
Author: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Tue Nov 1 15:58:28 2016 +0000
Fix auto-anchor bug when .* is inside an assertion.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@587 6239d852-aaf2-0410-a92c-
79f79f948069
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
src/pcre2_compile.c | 33 +++++++++++++++++++++++----------
testdata/testinput1 | 3 +++
testdata/testoutput1 | 4 ++++
3 files changed, 30 insertions(+), 10 deletions(-)
diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c
index fe37310..b9b9361 100644
--- a/src/pcre2_compile.c
+++ b/src/pcre2_compile.c
@@ -7960,13 +7960,14 @@ Arguments:
the less precise approach
cb points to the compile data block
atomcount atomic group level
+ inassert TRUE if in an assertion
Returns: TRUE or FALSE
*/
static BOOL
is_anchored(register PCRE2_SPTR code, unsigned int bracket_map,
- compile_block *cb, int atomcount)
+ compile_block *cb, int atomcount, BOOL inassert)
{
do {
PCRE2_SPTR scode = first_significant_code(
@@ -7978,7 +7979,8 @@ do {
if (op == OP_BRA || op == OP_BRAPOS ||
op == OP_SBRA || op == OP_SBRAPOS)
{
- if (!is_anchored(scode, bracket_map, cb, atomcount)) return FALSE;
+ if (!is_anchored(scode, bracket_map, cb, atomcount, inassert))
+ return FALSE;
}
/* Capturing brackets */
@@ -7988,33 +7990,44 @@ do {
{
int n = GET2(scode, 1+LINK_SIZE);
int new_map = bracket_map | ((n < 32)? (1u << n) : 1);
- if (!is_anchored(scode, new_map, cb, atomcount)) return FALSE;
+ if (!is_anchored(scode, new_map, cb, atomcount, inassert)) return FALSE;
}
- /* Positive forward assertions and conditions */
+ /* Positive forward assertion */
- else if (op == OP_ASSERT || op == OP_COND)
+ else if (op == OP_ASSERT)
{
- if (!is_anchored(scode, bracket_map, cb, atomcount)) return FALSE;
+ if (!is_anchored(scode, bracket_map, cb, atomcount, TRUE)) return FALSE;
+ }
+
+ /* Condition */
+
+ else if (op == OP_COND)
+ {
+ if (!is_anchored(scode, bracket_map, cb, atomcount, inassert))
+ return FALSE;
}
/* Atomic groups */
else if (op == OP_ONCE || op == OP_ONCE_NC)
{
- if (!is_anchored(scode, bracket_map, cb, atomcount + 1))
+ if (!is_anchored(scode, bracket_map, cb, atomcount + 1, inassert))
return FALSE;
}
/* .* is not anchored unless DOTALL is set (which generates OP_ALLANY) and
it isn't in brackets that are or may be referenced or inside an atomic
- group. There is also an option that disables auto-anchoring. */
+ group or an assertion. Also the pattern must not contain *PRUNE or *SKIP,
+ because these break the feature. Consider, for example, /(?s).*?(*PRUNE)b/
+ with the subject "aab", which matches "b", i.e. not at the start of a line.
+ There is also an option that disables auto-anchoring. */
else if ((op == OP_TYPESTAR || op == OP_TYPEMINSTAR ||
op == OP_TYPEPOSSTAR))
{
if (scode[1] != OP_ALLANY || (bracket_map & cb->backref_map) != 0 ||
- atomcount > 0 || cb->had_pruneorskip ||
+ atomcount > 0 || cb->had_pruneorskip || inassert ||
(cb->external_options & PCRE2_NO_DOTSTAR_ANCHOR) != 0)
return FALSE;
}
@@ -8984,7 +8997,7 @@ there are no occurrences of *PRUNE or *SKIP (though there is an option to
disable this case). */
if ((re->overall_options & PCRE2_ANCHORED) == 0 &&
- is_anchored(codestart, 0, &cb, 0))
+ is_anchored(codestart, 0, &cb, 0, FALSE))
re->overall_options |= PCRE2_ANCHORED;
/* If the pattern is still not anchored and we do not have a first code unit,
diff --git a/testdata/testinput1 b/testdata/testinput1
index 0d680d3..2b4ec2c 100644
--- a/testdata/testinput1
+++ b/testdata/testinput1
@@ -5798,4 +5798,7 @@ name)/mark
/(?=.*X)X$/
\ X
+/(?s)(?=.*?)b/
+ aabc
+
# End of testinput1
diff --git a/testdata/testoutput1 b/testdata/testoutput1
index 02e07bf..774a5ec 100644
--- a/testdata/testoutput1
+++ b/testdata/testoutput1
@@ -9265,4 +9265,8 @@ No match
\ X
0: X
+/(?s)(?=.*?)b/
+ aabc
+ 0: b
+
# End of testinput1
--
2.7.4

View File

@ -1,43 +0,0 @@
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

@ -1,69 +0,0 @@
From d2c8acf36b8d0654c22787facaf8e9cc34d34aec Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Thu, 8 Dec 2016 17:55:26 +0000
Subject: [PATCH] Fix buffer overflow in partial match test for CRLF in empty
buffer.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Petr Pisar: Ported to 10.22:
commit ec26c8fe3e0a6ee93060ecd7accaa0803dac2ee1
Author: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Thu Dec 8 17:55:26 2016 +0000
Fix buffer overflow in partial match test for CRLF in empty buffer.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@612 6239d852-aaf2-0410-a92c-79f79f948069
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
src/pcre2_match.c | 2 +-
testdata/testinput2 | 3 +++
testdata/testoutput2 | 4 ++++
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/pcre2_match.c b/src/pcre2_match.c
index 0763a23..09efb49 100644
--- a/src/pcre2_match.c
+++ b/src/pcre2_match.c
@@ -2382,7 +2382,7 @@ for (;;)
case OP_ANY:
if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH);
if (mb->partial != 0 &&
- eptr + 1 >= mb->end_subject &&
+ eptr == mb->end_subject - 1 &&
NLBLOCK->nltype == NLTYPE_FIXED &&
NLBLOCK->nllen == 2 &&
UCHAR21TEST(eptr) == NLBLOCK->nl[0])
diff --git a/testdata/testinput2 b/testdata/testinput2
index 94fbfab..3218cfe 100644
--- a/testdata/testinput2
+++ b/testdata/testinput2
@@ -4825,4 +4825,7 @@ a)"xI
/(?=.*[A-Z])/I
+/./newline=crlf
+\=ph
+
# End of testinput2
diff --git a/testdata/testoutput2 b/testdata/testoutput2
index bdb289d..1776d0d 100644
--- a/testdata/testoutput2
+++ b/testdata/testoutput2
@@ -15227,6 +15227,10 @@ Capturing subpattern count = 0
May match empty string
Subject length lower bound = 0
+/./newline=crlf
+\=ph
+No match
+
# End of testinput2
Error -63: PCRE2_ERROR_BADDATA (unknown error number)
Error -62: bad serialized data
--
2.7.4

View File

@ -1,372 +0,0 @@
From 8565d846f405861e3f6ae34914bb24b5e2002c45 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Wed, 3 Aug 2016 17:22:59 +0000
Subject: [PATCH] Fix bug that caused chars > 255 not to be matched by classes
like [\W\pL] when PCRE2_UCP was not set.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Ported to 10.22:
commit 143f7f5c4dabd978117d415d2016c7595a7b9867
Author: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Wed Aug 3 17:22:59 2016 +0000
Fix bug that caused chars > 255 not to be matched by classes like [\W\pL] when
PCRE2_UCP was not set.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@554 6239d852-aaf2-0410-a92c-79f79f948069
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
src/pcre2_compile.c | 49 ++++++++++++++++++++++++++++++++++--------------
testdata/testinput10 | 9 +++++++++
testdata/testinput12 | 11 +++++++++++
testdata/testinput5 | 26 ++++++++++++++++---------
testdata/testoutput10 | 25 ++++++++++++++++++++++++
testdata/testoutput12-16 | 29 ++++++++++++++++++++++++++++
testdata/testoutput12-32 | 29 ++++++++++++++++++++++++++++
testdata/testoutput5 | 49 ++++++++++++++++++++++++------------------------
8 files changed, 179 insertions(+), 48 deletions(-)
diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c
index bb9736c..a92a69a 100644
--- a/src/pcre2_compile.c
+++ b/src/pcre2_compile.c
@@ -4950,11 +4950,11 @@ for (;; ptr++)
}
#ifdef SUPPORT_WIDE_CHARS
- /* If any wide characters have been encountered, set xclass = TRUE. Then,
- in the pre-compile phase, accumulate the length of the wide characters
- and reset the pointer. This is so that very large classes that contain a
- zillion wide characters do not overwrite the work space (which is on the
- stack). */
+ /* If any wide characters or Unicode properties have been encountered,
+ set xclass = TRUE. Then, in the pre-compile phase, accumulate the length
+ of the wide characters etc. and reset the pointer. This is so that very
+ large classes that contain a zillion wide characters do not overwrite the
+ work space (which is on the stack). */
if (class_uchardata > class_uchardata_base)
{
@@ -4994,22 +4994,43 @@ for (;; ptr++)
negated). This requirement is indicated by match_all_or_no_wide_chars being
true. We do this by including an explicit range, which works in both cases.
+ When there *are* properties in a positive UTF-8 or any 16-bit or 32_bit
+ class where \S etc is present without PCRE2_UCP, causing an extended class
+ to be compiled, we make sure that all characters > 255 are included by
+ forcing match_all_or_no_wide_chars to be true.
+
If, when generating an xclass, there are no characters < 256, we can omit
the bitmap in the actual compiled code. */
-#ifdef SUPPORT_WIDE_CHARS
+#ifdef SUPPORT_WIDE_CHARS /* Defined for 16/32 bits, or 8-bit with Unicode */
+ if (xclass && (
#ifdef SUPPORT_UNICODE
- if (xclass && (xclass_has_prop || !should_flip_negation ||
- (options & PCRE2_UCP) != 0))
-#elif PCRE2_CODE_UNIT_WIDTH != 8
- if (xclass && (xclass_has_prop || !should_flip_negation))
+ (options & PCRE2_UCP) != 0 ||
#endif
+ xclass_has_prop || !should_flip_negation))
{
- if (match_all_or_no_wide_chars)
+ if (match_all_or_no_wide_chars || (
+#if PCRE2_CODE_UNIT_WIDTH == 8
+ utf &&
+#endif
+ should_flip_negation && !negate_class && (options & PCRE2_UCP) == 0))
{
*class_uchardata++ = XCL_RANGE;
- class_uchardata += PRIV(ord2utf)(0x100, class_uchardata);
- class_uchardata += PRIV(ord2utf)(MAX_UTF_CODE_POINT, class_uchardata);
+ if (utf) /* Will always be utf in the 8-bit library */
+ {
+ class_uchardata += PRIV(ord2utf)(0x100, class_uchardata);
+ class_uchardata += PRIV(ord2utf)(MAX_UTF_CODE_POINT, class_uchardata);
+ }
+ else /* Can only happen for the 16-bit & 32-bit libraries */
+ {
+#if PCRE2_CODE_UNIT_WIDTH == 16
+ *class_uchardata++ = 0x100;
+ *class_uchardata++ = 0xffffu;
+#elif PCRE2_CODE_UNIT_WIDTH == 32
+ *class_uchardata++ = 0x100;
+ *class_uchardata++ = 0xffffffffu;
+#endif
+ }
}
*class_uchardata++ = XCL_END; /* Marks the end of extra data */
*code++ = OP_XCLASS;
@@ -5037,7 +5058,7 @@ for (;; ptr++)
PUT(previous, 1, (int)(code - previous));
break; /* End of class handling */
}
-#endif
+#endif /* SUPPORT_WIDE_CHARS */
/* If there are no characters > 255, or they are all to be included or
excluded, set the opcode to OP_CLASS or OP_NCLASS, depending on whether the
diff --git a/testdata/testinput10 b/testdata/testinput10
index 550e1c9..4b80778 100644
--- a/testdata/testinput10
+++ b/testdata/testinput10
@@ -445,4 +445,13 @@
/(?<=(a)(?-1))x/I,utf
a\x80zx\=offset=3
+/[\W\p{Any}]/B
+ abc
+ 123
+
+/[\W\pL]/B
+ abc
+\= Expect no match
+ 123
+
# End of testinput10
diff --git a/testdata/testinput12 b/testdata/testinput12
index 14a7715..29934ec 100644
--- a/testdata/testinput12
+++ b/testdata/testinput12
@@ -343,4 +343,15 @@
/./utf
\x{110000}
+/[\W\p{Any}]/B
+ abc
+ 123
+
+/[\W\pL]/B
+ abc
+ \x{100}
+ \x{308}
+\= Expect no match
+ 123
+
# End of testinput12
diff --git a/testdata/testinput5 b/testdata/testinput5
index 2e13a7c..1f44ceb 100644
--- a/testdata/testinput5
+++ b/testdata/testinput5
@@ -1675,15 +1675,6 @@
/((?<digit>\d)|(?<letter>\p{L}))/g,substitute_extended,replace=<${digit:+digit; :not digit; }${letter:+letter:not a letter}>
ab12cde
-/[\W\p{Any}]/B
- abc
- 123
-
-/[\W\pL]/B
- abc
-\= Expect no match
- 123
-
/(*UCP)(*UTF)[[:>:]]X/B
/abc/utf,replace=xyz
@@ -1716,4 +1707,21 @@
/(*UTF)C\x09((?<!'(?x)!*H? #\xcc\x9a[^$]/
+/[\D]/utf
+ \x{1d7cf}
+
+/[\D\P{Nd}]/utf
+ \x{1d7cf}
+
+/[^\D]/utf
+ a9b
+\= Expect no match
+ \x{1d7cf}
+
+/[^\D\P{Nd}]/utf
+ a9b
+ \x{1d7cf}
+\= Expect no match
+ \x{10000}
+
# End of testinput5
diff --git a/testdata/testoutput10 b/testdata/testoutput10
index 9761f0f..0c1e9b2 100644
--- a/testdata/testoutput10
+++ b/testdata/testoutput10
@@ -1539,4 +1539,29 @@ Subject length lower bound = 1
a\x80zx\=offset=3
Failed: error -22: UTF-8 error: isolated byte with 0x80 bit set at offset 1
+/[\W\p{Any}]/B
+------------------------------------------------------------------
+ Bra
+ [\x00-/:-@[-^`{-\xff\p{Any}]
+ Ket
+ End
+------------------------------------------------------------------
+ abc
+ 0: a
+ 123
+ 0: 1
+
+/[\W\pL]/B
+------------------------------------------------------------------
+ Bra
+ [\x00-/:-@[-^`{-\xff\p{L}]
+ Ket
+ End
+------------------------------------------------------------------
+ abc
+ 0: a
+\= Expect no match
+ 123
+No match
+
# End of testinput10
diff --git a/testdata/testoutput12-16 b/testdata/testoutput12-16
index 383a032..9cd6640 100644
--- a/testdata/testoutput12-16
+++ b/testdata/testoutput12-16
@@ -1367,4 +1367,33 @@ Subject length lower bound = 2
\x{110000}
** Failed: character \x{110000} is greater than 0x10ffff and so cannot be converted to UTF-16
+/[\W\p{Any}]/B
+------------------------------------------------------------------
+ Bra
+ [\x00-/:-@[-^`{-\xff\p{Any}\x{100}-\x{ffff}]
+ Ket
+ End
+------------------------------------------------------------------
+ abc
+ 0: a
+ 123
+ 0: 1
+
+/[\W\pL]/B
+------------------------------------------------------------------
+ Bra
+ [\x00-/:-@[-^`{-\xff\p{L}\x{100}-\x{ffff}]
+ Ket
+ End
+------------------------------------------------------------------
+ abc
+ 0: a
+ \x{100}
+ 0: \x{100}
+ \x{308}
+ 0: \x{308}
+\= Expect no match
+ 123
+No match
+
# End of testinput12
diff --git a/testdata/testoutput12-32 b/testdata/testoutput12-32
index 95f1834..75a5ad7 100644
--- a/testdata/testoutput12-32
+++ b/testdata/testoutput12-32
@@ -1361,4 +1361,33 @@ Subject length lower bound = 2
\x{110000}
Failed: error -28: UTF-32 error: code points greater than 0x10ffff are not defined at offset 0
+/[\W\p{Any}]/B
+------------------------------------------------------------------
+ Bra
+ [\x00-/:-@[-^`{-\xff\p{Any}\x{100}-\x{ffffffff}]
+ Ket
+ End
+------------------------------------------------------------------
+ abc
+ 0: a
+ 123
+ 0: 1
+
+/[\W\pL]/B
+------------------------------------------------------------------
+ Bra
+ [\x00-/:-@[-^`{-\xff\p{L}\x{100}-\x{ffffffff}]
+ Ket
+ End
+------------------------------------------------------------------
+ abc
+ 0: a
+ \x{100}
+ 0: \x{100}
+ \x{308}
+ 0: \x{308}
+\= Expect no match
+ 123
+No match
+
# End of testinput12
diff --git a/testdata/testoutput5 b/testdata/testoutput5
index f19ad8c..b670677 100644
--- a/testdata/testoutput5
+++ b/testdata/testoutput5
@@ -4020,31 +4020,6 @@ MK: a\x{12345}b\x{09}(d)c
ab12cde
7: <not digit; letter><not digit; letter><digit; not a letter><digit; not a letter><not digit; letter><not digit; letter><not digit; letter>
-/[\W\p{Any}]/B
-------------------------------------------------------------------
- Bra
- [\x00-/:-@[-^`{-\xff\p{Any}]
- Ket
- End
-------------------------------------------------------------------
- abc
- 0: a
- 123
- 0: 1
-
-/[\W\pL]/B
-------------------------------------------------------------------
- Bra
- [\x00-/:-@[-^`{-\xff\p{L}]
- Ket
- End
-------------------------------------------------------------------
- abc
- 0: a
-\= Expect no match
- 123
-No match
-
/(*UCP)(*UTF)[[:>:]]X/B
------------------------------------------------------------------
Bra
@@ -4161,4 +4136,28 @@ No match
/(*UTF)C\x09((?<!'(?x)!*H? #\xcc\x9a[^$]/
Failed: error 114 at offset 39: missing closing parenthesis
+/[\D]/utf
+ \x{1d7cf}
+ 0: \x{1d7cf}
+
+/[\D\P{Nd}]/utf
+ \x{1d7cf}
+ 0: \x{1d7cf}
+
+/[^\D]/utf
+ a9b
+ 0: 9
+\= Expect no match
+ \x{1d7cf}
+No match
+
+/[^\D\P{Nd}]/utf
+ a9b
+ 0: 9
+ \x{1d7cf}
+ 0: \x{1d7cf}
+\= Expect no match
+ \x{10000}
+No match
+
# End of testinput5
--
2.5.5

View File

@ -1,74 +0,0 @@
From 3caf27da49d315b53783af8e602f6be09b435bc2 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Wed, 5 Oct 2016 16:53:34 +0000
Subject: [PATCH] Fix callout display bug in pcre2test.
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@557 6239d852-aaf2-0410-a92c-79f79f948069
Petr Písař: Ported to 10.22.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
src/pcre2test.c | 4 ++++
testdata/testinput5 | 3 +++
testdata/testoutput5 | 9 +++++++++
3 files changed, 16 insertions(+)
diff --git a/src/pcre2test.c b/src/pcre2test.c
index a8dffa3..96520e8 100644
--- a/src/pcre2test.c
+++ b/src/pcre2test.c
@@ -2525,6 +2525,8 @@ static int
pchar(uint32_t c, BOOL utf, FILE *f)
{
int n = 0;
+char tempbuffer[16];
+
if (PRINTOK(c))
{
if (f != NULL) fprintf(f, "%c", c);
@@ -2546,6 +2548,8 @@ if (c < 0x100)
}
if (f != NULL) n = fprintf(f, "\\x{%02x}", c);
+ else n = sprintf(tempbuffer, "\\x{%02x}", c);
+
return n >= 0 ? n : 0;
}
diff --git a/testdata/testinput5 b/testdata/testinput5
index 1f44ceb..461302a 100644
--- a/testdata/testinput5
+++ b/testdata/testinput5
@@ -1724,4 +1724,7 @@
\= Expect no match
\x{10000}
+/../utf,auto_callout
+ \n\x{123}\x{123}\x{123}\x{123}
+
# End of testinput5
diff --git a/testdata/testoutput5 b/testdata/testoutput5
index b670677..e661033 100644
--- a/testdata/testoutput5
+++ b/testdata/testoutput5
@@ -4160,4 +4160,13 @@ No match
\x{10000}
No match
+/../utf,auto_callout
+ \n\x{123}\x{123}\x{123}\x{123}
+--->\x{0a}\x{123}\x{123}\x{123}\x{123}
+ +0 ^ .
+ +0 ^ .
+ +1 ^ ^ .
+ +2 ^ ^
+ 0: \x{123}\x{123}
+
# End of testinput5
--
2.7.4

View File

@ -1,137 +0,0 @@
From b3343e2c2c77b85f841a7af5e4121dab11692065 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Mon, 26 Dec 2016 17:11:18 +0000
Subject: [PATCH] Fix class bug when UCP but not UTF was set and all wide
characters need to be included.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Ported to 10.22:
commit a83027bb4b195c879d504da051571f22a5ac7ca3
Author: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Mon Dec 26 17:11:18 2016 +0000
Fix class bug when UCP but not UTF was set and all wide characters need to b
e
included.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@628 6239d852-aaf2-0410-a92c-79f79f948069
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
src/pcre2_compile.c | 10 ++++++++--
testdata/testinput10 | 2 ++
testdata/testinput12 | 2 ++
testdata/testoutput10 | 8 ++++++++
testdata/testoutput12-16 | 8 ++++++++
testdata/testoutput12-32 | 8 ++++++++
6 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c
index ae6b5e1..2c9f758 100644
--- a/src/pcre2_compile.c
+++ b/src/pcre2_compile.c
@@ -4482,10 +4482,14 @@ for (;; ptr++)
In the special case where there are no xclass items, this is
automatically handled by the use of OP_CLASS or OP_NCLASS, but an
explicit range is needed for OP_XCLASS. Setting a flag here causes
- the range to be generated later when it is known that OP_XCLASS is
- required. */
+ the range to be generated later when it is known that
+ OP_XCLASS is required. In the 8-bit library this is relevant only in
+ utf mode, since no wide characters can exist otherwise. */
default:
+#if PCRE2_CODE_UNIT_WIDTH == 8
+ if (utf)
+#endif
match_all_or_no_wide_chars |= local_negate;
break;
}
@@ -4993,6 +4997,8 @@ for (;; ptr++)
all wide characters (depending on whether the whole class is or is not
negated). This requirement is indicated by match_all_or_no_wide_chars being
true. We do this by including an explicit range, which works in both cases.
+ This applies only in UTF and 16-bit and 32-bit non-UTF modes, since there
+ cannot be any wide characters in 8-bit non-UTF mode.
When there *are* properties in a positive UTF-8 or any 16-bit or 32_bit
class where \S etc is present without PCRE2_UCP, causing an extended class
diff --git a/testdata/testinput10 b/testdata/testinput10
index 4b80778..1c6134b 100644
--- a/testdata/testinput10
+++ b/testdata/testinput10
@@ -454,4 +454,6 @@
\= Expect no match
123
+/[\s[:^ascii:]]/B,ucp
+
# End of testinput10
diff --git a/testdata/testinput12 b/testdata/testinput12
index 29934ec..d851ae6 100644
--- a/testdata/testinput12
+++ b/testdata/testinput12
@@ -354,4 +354,6 @@
\= Expect no match
123
+/[\s[:^ascii:]]/B,ucp
+
# End of testinput12
diff --git a/testdata/testoutput10 b/testdata/testoutput10
index 0c1e9b2..aef89ca 100644
--- a/testdata/testoutput10
+++ b/testdata/testoutput10
@@ -1564,4 +1564,12 @@ Failed: error -22: UTF-8 error: isolated byte with 0x80 bit set at offset 1
123
No match
+/[\s[:^ascii:]]/B,ucp
+------------------------------------------------------------------
+ Bra
+ [\x80-\xff\p{Xsp}]
+ Ket
+ End
+------------------------------------------------------------------
+
# End of testinput10
diff --git a/testdata/testoutput12-16 b/testdata/testoutput12-16
index 9cd6640..e2d5b9f 100644
--- a/testdata/testoutput12-16
+++ b/testdata/testoutput12-16
@@ -1396,4 +1396,12 @@ Subject length lower bound = 2
123
No match
+/[\s[:^ascii:]]/B,ucp
+------------------------------------------------------------------
+ Bra
+ [\x80-\xff\p{Xsp}\x{100}-\x{ffff}]
+ Ket
+ End
+------------------------------------------------------------------
+
# End of testinput12
diff --git a/testdata/testoutput12-32 b/testdata/testoutput12-32
index 75a5ad7..7479a93 100644
--- a/testdata/testoutput12-32
+++ b/testdata/testoutput12-32
@@ -1390,4 +1390,12 @@ Failed: error -28: UTF-32 error: code points greater than 0x10ffff are not defin
123
No match
+/[\s[:^ascii:]]/B,ucp
+------------------------------------------------------------------
+ Bra
+ [\x80-\xff\p{Xsp}\x{100}-\x{ffffffff}]
+ Ket
+ End
+------------------------------------------------------------------
+
# End of testinput12
--
2.7.4

View File

@ -1,112 +0,0 @@
From 953d56f59bb13f5d6ebef31597b48e446659f368 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Thu, 8 Dec 2016 18:56:24 +0000
Subject: [PATCH] Fix crash in pcre2test when displaying a wide character with
a locale set.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Petr Pisar: Ported to 10.22:
commit f35783211054aec20925a2efdf936a00d12db0df
Author: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Thu Dec 8 18:56:24 2016 +0000
Fix crash in pcre2test when displaying a wide character with a locale set.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@613 6239d852-aaf2-0410-a92c-
79f79f948069
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
src/pcre2test.c | 8 ++++----
testdata/testinput5 | 11 +++++++++++
testdata/testoutput5 | 13 +++++++++++++
3 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/src/pcre2test.c b/src/pcre2test.c
index 96d9075..48b0f27 100644
--- a/src/pcre2test.c
+++ b/src/pcre2test.c
@@ -211,7 +211,7 @@ systems that differ in their output from isprint() even in the "C" locale. */
#define PRINTABLE(c) ((c) >= 32 && (c) < 127)
#endif
-#define PRINTOK(c) ((locale_tables != NULL)? isprint(c) : PRINTABLE(c))
+#define PRINTOK(c) ((use_tables != NULL && c < 256)? isprint(c) : PRINTABLE(c))
/* We have to include some of the library source files because we need
to use some of the macros, internal structure definitions, and other internal
@@ -823,6 +823,7 @@ static regex_t preg = { NULL, NULL, 0, 0, 0 };
static int *dfa_workspace = NULL;
static const uint8_t *locale_tables = NULL;
+static const uint8_t *use_tables = NULL;
static uint8_t locale_name[32];
/* We need buffers for building 16/32-bit strings; 8-bit strings don't need
@@ -4464,7 +4465,6 @@ process_pattern(void)
BOOL utf;
uint32_t k;
uint8_t *p = buffer;
-const uint8_t *use_tables;
unsigned int delimiter = *p++;
int errorcode;
void *use_pat_context;
@@ -4922,8 +4922,8 @@ if ((pat_patctl.control & CTL_NL_SET) == 0 && local_newline_default != 0)
SETFLD(pat_context, newline_convention, local_newline_default);
}
-/* The nullcontext modifier is used to test calling pcre2_compile() with a NULL
-context. */
+/* The null_context modifier is used to test calling pcre2_compile() with a
+NULL context. */
use_pat_context = ((pat_patctl.control & CTL_NULLCONTEXT) != 0)?
NULL : PTR(pat_context);
diff --git a/testdata/testinput5 b/testdata/testinput5
index 461302a..e9b4d83 100644
--- a/testdata/testinput5
+++ b/testdata/testinput5
@@ -1727,4 +1727,15 @@
/../utf,auto_callout
\n\x{123}\x{123}\x{123}\x{123}
+# These three test a bug fix that was not clearing up after a locale setting
+# when the test or a subsequent one matched a wide character.
+
+//locale=C
+
+/[\P{Yi}]/utf
+\x{2f000}
+
+/[\P{Yi}]/utf,locale=C
+\x{2f000}
+
# End of testinput5
diff --git a/testdata/testoutput5 b/testdata/testoutput5
index e661033..993aba0 100644
--- a/testdata/testoutput5
+++ b/testdata/testoutput5
@@ -4169,4 +4169,17 @@ No match
+2 ^ ^
0: \x{123}\x{123}
+# These three test a bug fix that was not clearing up after a locale setting
+# when the test or a subsequent one matched a wide character.
+
+//locale=C
+
+/[\P{Yi}]/utf
+\x{2f000}
+ 0: \x{2f000}
+
+/[\P{Yi}]/utf,locale=C
+\x{2f000}
+ 0: \x{2f000}
+
# End of testinput5
--
2.7.4

View File

@ -1,39 +0,0 @@
From 8e64a87e1ee27f4e1ac96d97634d1e52d1f33953 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Fri, 14 Oct 2016 17:06:34 +0000
Subject: [PATCH] Fix documentation error.
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@569 6239d852-aaf2-0410-a92c-79f79f948069
Petr Písař: Ported to 10.22.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
doc/pcre2pattern.3 | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/doc/pcre2pattern.3 b/doc/pcre2pattern.3
index 36318cf..57b0014 100644
--- a/doc/pcre2pattern.3
+++ b/doc/pcre2pattern.3
@@ -1550,12 +1550,8 @@ respectively.
.P
When one of these option changes occurs at top level (that is, not inside
subpattern parentheses), the change applies to the remainder of the pattern
-that follows. If the change is placed right at the start of a pattern, PCRE2
-extracts it into the global options (and it will therefore show up in data
-extracted by the \fBpcre2_pattern_info()\fP function).
-.P
-An option change within a subpattern (see below for a description of
-subpatterns) affects only that part of the subpattern that follows it, so
+that follows. An option change within a subpattern (see below for a description
+of subpatterns) affects only that part of the subpattern that follows it, so
.sp
(a(?i)b)c
.sp
--
2.7.4

View File

@ -1,280 +0,0 @@
From 95d88c4044fb74af8c3259db6413214fe9a106e2 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Tue, 18 Oct 2016 11:22:40 +0000
Subject: [PATCH] Fix optimization bugs when pattern starts with lookahead.
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@573 6239d852-aaf2-0410-a92c-79f79f948069
Petr Písař: Ported to 10.22.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
src/pcre2_compile.c | 63 ++++++++++++++++++++++++++++++----------------------
testdata/testinput1 | 6 +++++
testdata/testinput2 | 2 ++
testdata/testinput4 | 6 +++++
testdata/testoutput1 | 8 +++++++
testdata/testoutput2 | 6 ++++-
testdata/testoutput4 | 8 +++++++
7 files changed, 72 insertions(+), 27 deletions(-)
diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c
index b3ebb25..fe37310 100644
--- a/src/pcre2_compile.c
+++ b/src/pcre2_compile.c
@@ -5553,8 +5553,9 @@ for (;; ptr++)
*lengthptr += delta;
}
- /* This is compiling for real. If there is a set first byte for
- the group, and we have not yet set a "required byte", set it. */
+ /* This is compiling for real. If there is a set first code unit
+ for the group, and we have not yet set a "required code unit", set
+ it. */
else
{
@@ -7185,7 +7186,7 @@ for (;; ptr++)
zerofirstcuflags = firstcuflags;
groupsetfirstcu = FALSE;
- if (bravalue >= OP_ONCE)
+ if (bravalue >= OP_ONCE) /* Not an assertion */
{
/* If we have not yet set a firstcu in this branch, take it from the
subpattern, remembering that it was set here so that a repeat of more
@@ -7225,15 +7226,19 @@ for (;; ptr++)
}
}
- /* For a forward assertion, we take the reqcu, if set. This can be
- helpful if the pattern that follows the assertion doesn't set a different
- char. For example, it's useful for /(?=abcde).+/. We can't set firstcu
- for an assertion, however because it leads to incorrect effect for patterns
- such as /(?=a)a.+/ when the "real" "a" would then become a reqcu instead
- of a firstcu. This is overcome by a scan at the end if there's no
- firstcu, looking for an asserted first char. */
-
- else if (bravalue == OP_ASSERT && subreqcuflags >= 0)
+ /* For a forward assertion, we take the reqcu, if set, provided that the
+ group has also set a firstcu. This can be helpful if the pattern that
+ follows the assertion doesn't set a different char. For example, it's
+ useful for /(?=abcde).+/. We can't set firstcu for an assertion, however
+ because it leads to incorrect effect for patterns such as /(?=a)a.+/ when
+ the "real" "a" would then become a reqcu instead of a firstcu. This is
+ overcome by a scan at the end if there's no firstcu, looking for an
+ asserted first char. A similar effect for patterns like /(?=.*X)X$/ means
+ we must only take the reqcu when the group also set a firstcu. Otherwise,
+ in that example, 'X' ends up set for both. */
+
+ else if (bravalue == OP_ASSERT && subreqcuflags >= 0 &&
+ subfirstcuflags >= 0)
{
reqcu = subreqcu;
reqcuflags = subreqcuflags;
@@ -8036,8 +8041,8 @@ matching and for non-DOTALL patterns that start with .* (which must start at
the beginning or after \n). As in the case of is_anchored() (see above), we
have to take account of back references to capturing brackets that contain .*
because in that case we can't make the assumption. Also, the appearance of .*
-inside atomic brackets or in a pattern that contains *PRUNE or *SKIP does not
-count, because once again the assumption no longer holds.
+inside atomic brackets or in an assertion, or in a pattern that contains *PRUNE
+or *SKIP does not count, because once again the assumption no longer holds.
Arguments:
code points to start of the compiled pattern or a group
@@ -8046,13 +8051,14 @@ Arguments:
the less precise approach
cb points to the compile data
atomcount atomic group level
+ inassert TRUE if in an assertion
Returns: TRUE or FALSE
*/
static BOOL
is_startline(PCRE2_SPTR code, unsigned int bracket_map, compile_block *cb,
- int atomcount)
+ int atomcount, BOOL inassert)
{
do {
PCRE2_SPTR scode = first_significant_code(
@@ -8083,7 +8089,7 @@ do {
return FALSE;
default: /* Assertion */
- if (!is_startline(scode, bracket_map, cb, atomcount)) return FALSE;
+ if (!is_startline(scode, bracket_map, cb, atomcount, TRUE)) return FALSE;
do scode += GET(scode, 1); while (*scode == OP_ALT);
scode += 1 + LINK_SIZE;
break;
@@ -8097,7 +8103,8 @@ do {
if (op == OP_BRA || op == OP_BRAPOS ||
op == OP_SBRA || op == OP_SBRAPOS)
{
- if (!is_startline(scode, bracket_map, cb, atomcount)) return FALSE;
+ if (!is_startline(scode, bracket_map, cb, atomcount, inassert))
+ return FALSE;
}
/* Capturing brackets */
@@ -8107,33 +8114,36 @@ do {
{
int n = GET2(scode, 1+LINK_SIZE);
int new_map = bracket_map | ((n < 32)? (1u << n) : 1);
- if (!is_startline(scode, new_map, cb, atomcount)) return FALSE;
+ if (!is_startline(scode, new_map, cb, atomcount, inassert)) return FALSE;
}
/* Positive forward assertions */
else if (op == OP_ASSERT)
{
- if (!is_startline(scode, bracket_map, cb, atomcount)) return FALSE;
+ if (!is_startline(scode, bracket_map, cb, atomcount, TRUE))
+ return FALSE;
}
/* Atomic brackets */
else if (op == OP_ONCE || op == OP_ONCE_NC)
{
- if (!is_startline(scode, bracket_map, cb, atomcount + 1)) return FALSE;
+ if (!is_startline(scode, bracket_map, cb, atomcount + 1, inassert))
+ return FALSE;
}
/* .* means "start at start or after \n" if it isn't in atomic brackets or
- brackets that may be referenced, as long as the pattern does not contain
- *PRUNE or *SKIP, because these break the feature. Consider, for example,
- /.*?a(*PRUNE)b/ with the subject "aab", which matches "ab", i.e. not at the
- start of a line. There is also an option that disables this optimization. */
+ brackets that may be referenced or an assertion, and as long as the pattern
+ does not contain *PRUNE or *SKIP, because these break the feature. Consider,
+ for example, /.*?a(*PRUNE)b/ with the subject "aab", which matches "ab",
+ i.e. not at the start of a line. There is also an option that disables this
+ optimization. */
else if (op == OP_TYPESTAR || op == OP_TYPEMINSTAR || op == OP_TYPEPOSSTAR)
{
if (scode[1] != OP_ANY || (bracket_map & cb->backref_map) != 0 ||
- atomcount > 0 || cb->had_pruneorskip ||
+ atomcount > 0 || cb->had_pruneorskip || inassert ||
(cb->external_options & PCRE2_NO_DOTSTAR_ANCHOR) != 0)
return FALSE;
}
@@ -9023,7 +9033,8 @@ if ((re->overall_options & (PCRE2_ANCHORED|PCRE2_NO_START_OPTIMIZE)) == 0)
when *PRUNE and SKIP are not present. (There is an option that disables this
case.) */
- else if (is_startline(codestart, 0, &cb, 0)) re->flags |= PCRE2_STARTLINE;
+ else if (is_startline(codestart, 0, &cb, 0, FALSE))
+ re->flags |= PCRE2_STARTLINE;
}
/* Handle the "required code unit", if one is set. In the case of an anchored
diff --git a/testdata/testinput1 b/testdata/testinput1
index 6d7bc80..0d680d3 100644
--- a/testdata/testinput1
+++ b/testdata/testinput1
@@ -5792,4 +5792,10 @@ name)/mark
aaaccccaaa
bccccb
+/(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[,;:])(?=.{8,16})(?!.*[\s])/
+ \ Fred:099
+
+/(?=.*X)X$/
+ \ X
+
# End of testinput1
diff --git a/testdata/testinput2 b/testdata/testinput2
index 2d4bbe5..94fbfab 100644
--- a/testdata/testinput2
+++ b/testdata/testinput2
@@ -4823,4 +4823,6 @@ a)"xI
/(?<R>abc)(?(R)xyz)/B
+/(?=.*[A-Z])/I
+
# End of testinput2
diff --git a/testdata/testinput4 b/testdata/testinput4
index ce9145d..73582b7 100644
--- a/testdata/testinput4
+++ b/testdata/testinput4
@@ -2282,4 +2282,10 @@
\x{389}
\x{20ac}
+/(?=.*b)\pL/
+ 11bb
+
+/(?(?=.*b)(?=.*b)\pL|.*c)/
+ 11bb
+
# End of testinput4
diff --git a/testdata/testoutput1 b/testdata/testoutput1
index d28bf91..02e07bf 100644
--- a/testdata/testoutput1
+++ b/testdata/testoutput1
@@ -9257,4 +9257,12 @@ No match
1: b
2: cccc
+/(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[,;:])(?=.{8,16})(?!.*[\s])/
+ \ Fred:099
+ 0:
+
+/(?=.*X)X$/
+ \ X
+ 0: X
+
# End of testinput1
diff --git a/testdata/testoutput2 b/testdata/testoutput2
index ef7e329..bdb289d 100644
--- a/testdata/testoutput2
+++ b/testdata/testoutput2
@@ -8751,7 +8751,6 @@ Subject length lower bound = 1
/(?(?=.*b).*b|^d)/I
Capturing subpattern count = 0
-First code unit at start or follows newline
Subject length lower bound = 1
/xyz/auto_callout
@@ -15223,6 +15222,11 @@ No match
End
------------------------------------------------------------------
+/(?=.*[A-Z])/I
+Capturing subpattern count = 0
+May match empty string
+Subject length lower bound = 0
+
# End of testinput2
Error -63: PCRE2_ERROR_BADDATA (unknown error number)
Error -62: bad serialized data
diff --git a/testdata/testoutput4 b/testdata/testoutput4
index 701d411..d2d5e51 100644
--- a/testdata/testoutput4
+++ b/testdata/testoutput4
@@ -3703,4 +3703,12 @@ No match
\x{20ac}
No match
+/(?=.*b)\pL/
+ 11bb
+ 0: b
+
+/(?(?=.*b)(?=.*b)\pL|.*c)/
+ 11bb
+ 0: b
+
# End of testinput4
--
2.7.4

View File

@ -1,81 +0,0 @@
From b6c92f4b6b35ce09afcbfd71170b72d3a8bb063d Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Wed, 11 Jan 2017 17:02:27 +0000
Subject: [PATCH] Fix pcre2test mishandling "end before start" return with
POSIX interface.
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@650 6239d852-aaf2-0410-a92c-79f79f948069
Petr Písař: Ported to 10.22.
diff --git a/src/pcre2test.c b/src/pcre2test.c
index d9c8ed8..5ea245d 100644
--- a/src/pcre2test.c
+++ b/src/pcre2test.c
@@ -6184,18 +6184,27 @@ if ((pat_patctl.control & CTL_POSIX) != 0)
{
if (pmatch[i].rm_so >= 0)
{
+ PCRE2_SIZE start = pmatch[i].rm_so;
+ PCRE2_SIZE end = pmatch[i].rm_eo;
+ if (start > end)
+ {
+ start = pmatch[i].rm_eo;
+ end = pmatch[i].rm_so;
+ fprintf(outfile, "Start of matched string is beyond its end - "
+ "displaying from end to start.\n");
+ }
fprintf(outfile, "%2d: ", (int)i);
- PCHARSV(pp, pmatch[i].rm_so,
- pmatch[i].rm_eo - pmatch[i].rm_so, utf, outfile);
+ PCHARSV(pp, start, end - start, utf, outfile);
fprintf(outfile, "\n");
+
if ((i == 0 && (dat_datctl.control & CTL_AFTERTEXT) != 0) ||
(dat_datctl.control & CTL_ALLAFTERTEXT) != 0)
{
fprintf(outfile, "%2d+ ", (int)i);
- PCHARSV(pp, pmatch[i].rm_eo, len - pmatch[i].rm_eo,
- utf, outfile);
- fprintf(outfile, "\n");
- }
+ /* Note: don't use the start/end variables here because we want to
+ show the text from what is reported as the end. */
+ PCHARSV(pp, pmatch[i].rm_eo, len - pmatch[i].rm_eo, utf, outfile);
+ fprintf(outfile, "\n"); }
}
}
}
diff --git a/testdata/testinput18 b/testdata/testinput18
index ea47a4d..bd1c6ad 100644
--- a/testdata/testinput18
+++ b/testdata/testinput18
@@ -106,4 +106,7 @@
//posix_nosub
\=offset=70000
+/(?=(a\K))/
+ a
+
# End of testdata/testinput18
diff --git a/testdata/testoutput18 b/testdata/testoutput18
index 51c7d21..fd6fac3 100644
--- a/testdata/testoutput18
+++ b/testdata/testoutput18
@@ -162,4 +162,10 @@ Failed: POSIX code 4: ? * + invalid at offset 1000001
** Ignored with POSIX interface: offset
Matched with REG_NOSUB
+/(?=(a\K))/
+ a
+Start of matched string is beyond its end - displaying from end to start.
+ 0: a
+ 1: a
+
# End of testdata/testinput18
--
2.7.4

View File

@ -1,54 +0,0 @@
From 13d269bc77ecca631b4601d25365e65d3d4fe733 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Thu, 8 Dec 2016 16:52:26 +0000
Subject: [PATCH] Fix small memory leak in error code path.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Petr Pisar: Ported to 10.22:
commit 5aaf9811e3fed9c86b39e3ecada0454240b7caae
Author: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Thu Dec 8 16:52:26 2016 +0000
Fix small memory leak in error code path.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@611 6239d852-aaf2-0410-a92c-79f79f948069
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
src/pcre2_compile.c | 4 ++--
src/pcre2test.c | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c
index b9b9361..ed81639 100644
--- a/src/pcre2_compile.c
+++ b/src/pcre2_compile.c
@@ -191,8 +191,8 @@ comparison). */
locale, and may mark arbitrary characters as digits. We want to recognize only
0-9, a-z, and A-Z as hex digits, which is why we have a private table here. It
costs 256 bytes, but it is a lot faster than doing character value tests (at
-least in some simple cases I timed), and in some applications one wants PCRE to
-compile efficiently as well as match efficiently. The value in the table is
+least in some simple cases I timed), and in some applications one wants PCRE2
+to compile efficiently as well as match efficiently. The value in the table is
the binary hex digit value, or 0xff for non-hex digits. */
/* This is the "normal" case, for ASCII systems, and EBCDIC systems running in
diff --git a/src/pcre2test.c b/src/pcre2test.c
index 1844375..96d9075 100644
--- a/src/pcre2test.c
+++ b/src/pcre2test.c
@@ -4411,6 +4411,7 @@ switch(cmd)
if (fread(serial, 1, serial_size, f) != serial_size)
{
fprintf(outfile, "** Wrong return from fread()\n");
+ free(serial);
return PR_ABEND;
}
fclose(f);
--
2.7.4

View File

@ -1,59 +0,0 @@
From 21a37ed924de50cc36ff47b17a9711058bb5ab2e Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Thu, 6 Oct 2016 17:44:39 +0000
Subject: [PATCH] Fix typos in documentation.
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@560 6239d852-aaf2-0410-a92c-79f79f948069
Petr Písař: Ported to 10.22.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
doc/pcre2pattern.3 | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/doc/pcre2pattern.3 b/doc/pcre2pattern.3
index 70ac14a..4516ffc 100644
--- a/doc/pcre2pattern.3
+++ b/doc/pcre2pattern.3
@@ -359,8 +359,7 @@ case letter, it is converted to upper case. Then bit 6 of the character (hex
40) is inverted. Thus \ecA to \ecZ become hex 01 to hex 1A (A is 41, Z is 5A),
but \ec{ becomes hex 3B ({ is 7B), and \ec; becomes hex 7B (; is 3B). If the
code unit following \ec has a value less than 32 or greater than 126, a
-compile-time error occurs. This locks out non-printable ASCII characters in all
-modes.
+compile-time error occurs.
.P
When PCRE2 is compiled in EBCDIC mode, \ea, \ee, \ef, \en, \er, and \et
generate the appropriate EBCDIC code values. The \ec escape is processed
@@ -369,19 +368,19 @@ that are allowed after \ec are A-Z, a-z, or one of @, [, \e, ], ^, _, or ?. Any
other character provokes a compile-time error. The sequence \e@ encodes
character code 0; the letters (in either case) encode characters 1-26 (hex 01
to hex 1A); [, \e, ], ^, and _ encode characters 27-31 (hex 1B to hex 1F), and
-\e? becomes either 255 (hex FF) or 95 (hex 5F).
+\ec? becomes either 255 (hex FF) or 95 (hex 5F).
.P
-Thus, apart from \e?, these escapes generate the same character code values as
+Thus, apart from \ec?, these escapes generate the same character code values as
they do in an ASCII environment, though the meanings of the values mostly
-differ. For example, \eG always generates code value 7, which is BEL in ASCII
+differ. For example, \ecG always generates code value 7, which is BEL in ASCII
but DEL in EBCDIC.
.P
-The sequence \e? generates DEL (127, hex 7F) in an ASCII environment, but
+The sequence \ec? generates DEL (127, hex 7F) in an ASCII environment, but
because 127 is not a control character in EBCDIC, Perl makes it generate the
APC character. Unfortunately, there are several variants of EBCDIC. In most of
them the APC character has the value 255 (hex FF), but in the one Perl calls
POSIX-BC its value is 95 (hex 5F). If certain other characters have POSIX-BC
-values, PCRE2 makes \e? generate 95; otherwise it generates 255.
+values, PCRE2 makes \ec? generate 95; otherwise it generates 255.
.P
After \e0 up to two further octal digits are read. If there are fewer than two
digits, just those that are present are used. Thus the sequence \e0\ex\e015
--
2.7.4

View File

@ -1,36 +0,0 @@
From 509ecc74dcbbcfabc01f4d290c9cc8b62c921ac4 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Thu, 6 Oct 2016 17:48:24 +0000
Subject: [PATCH] Missed typo fixed.
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@561 6239d852-aaf2-0410-a92c-79f79f948069
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
doc/pcre2pattern.3 | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/doc/pcre2pattern.3 b/doc/pcre2pattern.3
index 3cde744..f9d1f53 100644
--- a/doc/pcre2pattern.3
+++ b/doc/pcre2pattern.3
@@ -365,10 +365,10 @@ When PCRE2 is compiled in EBCDIC mode, \ea, \ee, \ef, \en, \er, and \et
generate the appropriate EBCDIC code values. The \ec escape is processed
as specified for Perl in the \fBperlebcdic\fP document. The only characters
that are allowed after \ec are A-Z, a-z, or one of @, [, \e, ], ^, _, or ?. Any
-other character provokes a compile-time error. The sequence \e@ encodes
-character code 0; the letters (in either case) encode characters 1-26 (hex 01
-to hex 1A); [, \e, ], ^, and _ encode characters 27-31 (hex 1B to hex 1F), and
-\ec? becomes either 255 (hex FF) or 95 (hex 5F).
+other character provokes a compile-time error. The sequence \ec@ encodes
+character code 0; after \ec the letters (in either case) encode characters 1-26
+(hex 01 to hex 1A); [, \e, ], ^, and _ encode characters 27-31 (hex 1B to hex
+1F), and \ec? becomes either 255 (hex FF) or 95 (hex 5F).
.P
Thus, apart from \ec?, these escapes generate the same character code values as
they do in an ASCII environment, though the meanings of the values mostly
--
2.7.4

View File

@ -1,66 +0,0 @@
From f93df8c28fb7e00063612edaff46c3e9ad46e99d Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Sun, 23 Oct 2016 16:18:15 +0000
Subject: [PATCH] The "offset" modifier in pcre2test was not being ignored (as
documented) for POSIX.
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@576 6239d852-aaf2-0410-a92c-79f79f948069
Petr Písař: Ported to 10.22
diff --git a/src/pcre2test.c b/src/pcre2test.c
index 039a4f0..30fd190 100644
--- a/src/pcre2test.c
+++ b/src/pcre2test.c
@@ -6065,6 +6065,7 @@ if ((pat_patctl.control & CTL_POSIX) != 0)
if (dat_datctl.get_numbers[0] >= 0 || dat_datctl.get_names[0] != 0)
prmsg(&msg, "get");
if (dat_datctl.jitstack != 0) prmsg(&msg, "jitstack");
+ if (dat_datctl.offset != 0) prmsg(&msg, "offset");
if ((dat_datctl.options & ~POSIX_SUPPORTED_MATCH_OPTIONS) != 0)
{
@@ -6087,9 +6088,8 @@ if ((pat_patctl.control & CTL_POSIX) != 0)
if ((dat_datctl.options & PCRE2_NOTBOL) != 0) eflags |= REG_NOTBOL;
if ((dat_datctl.options & PCRE2_NOTEOL) != 0) eflags |= REG_NOTEOL;
if ((dat_datctl.options & PCRE2_NOTEMPTY) != 0) eflags |= REG_NOTEMPTY;
-
- rc = regexec(&preg, (const char *)pp + dat_datctl.offset,
- dat_datctl.oveccount, pmatch, eflags);
+
+ rc = regexec(&preg, (const char *)pp, dat_datctl.oveccount, pmatch, eflags);
if (rc != 0)
{
(void)regerror(rc, &preg, (char *)pbuffer8, pbuffer8_size);
diff --git a/testdata/testinput18 b/testdata/testinput18
index e31b96e..ea47a4d 100644
--- a/testdata/testinput18
+++ b/testdata/testinput18
@@ -103,4 +103,7 @@
/\[A]{1000000}**/expand,regerror_buffsize=32
+//posix_nosub
+ \=offset=70000
+
# End of testdata/testinput18
diff --git a/testdata/testoutput18 b/testdata/testoutput18
index 3df298c..e2eb009 100644
--- a/testdata/testoutput18
+++ b/testdata/testoutput18
@@ -157,4 +157,9 @@ Failed: POSIX code 4: ? * + invalid at offset 100000
/\[A]{1000000}**/expand,regerror_buffsize=32
Failed: POSIX code 4: ? * + invalid at offset 1000001
+//posix_nosub
+ \=offset=70000
+** Ignored with POSIX interface: offset
+Matched with REG_NOSUB
+
# End of testdata/testinput18
--
2.7.4

View File

@ -0,0 +1,47 @@
From 415b992217a1e393fac5f4a6893013135510cda0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Tue, 17 Jan 2017 13:48:37 +0100
Subject: [PATCH] Fix warning on printing pointer difference
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
src/pcre2test.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/pcre2test.c b/src/pcre2test.c
index 5ea245d..e1c8d25 100644
--- a/src/pcre2test.c
+++ b/src/pcre2test.c
@@ -4663,7 +4663,7 @@ if ((pat_patctl.control & CTL_HEXPAT) != 0)
if (d == 0)
{
fprintf(outfile, "** Missing closing quote in hex pattern: "
- "opening quote is at offset %lu.\n", pq - buffer - 2);
+ "opening quote is at offset %td.\n", pq - buffer - 2);
return PR_SKIP;
}
if (d == c) break;
@@ -4677,7 +4677,7 @@ if ((pat_patctl.control & CTL_HEXPAT) != 0)
{
if (!isxdigit(c))
{
- fprintf(outfile, "** Unexpected non-hex-digit '%c' at offset %lu "
+ fprintf(outfile, "** Unexpected non-hex-digit '%c' at offset %td "
"in hex pattern: quote missing?\n", c, pp - buffer - 2);
return PR_SKIP;
}
@@ -4689,7 +4689,7 @@ if ((pat_patctl.control & CTL_HEXPAT) != 0)
d = *pp;
if (!isxdigit(d))
{
- fprintf(outfile, "** Unexpected non-hex-digit '%c' at offset %lu "
+ fprintf(outfile, "** Unexpected non-hex-digit '%c' at offset %td "
"in hex pattern: quote missing?\n", d, pp - buffer - 1);
return PR_SKIP;
}
--
2.7.4

View File

@ -1,8 +1,8 @@
# This is stable release:
#%%global rcversion RC1
%global rcversion RC1
Name: pcre2
Version: 10.22
Release: %{?rcversion:0.}10%{?rcversion:.%rcversion}%{?dist}.1
Version: 10.23
Release: %{?rcversion:0.}1%{?rcversion:.%rcversion}%{?dist}
%global myversion %{version}%{?rcversion:-%rcversion}
Summary: Perl-compatible regular expression library
Group: System Environment/Libraries
@ -12,72 +12,32 @@ Group: System Environment/Libraries
# LICENSE: BSD text and declares Public Domain
# for testdata
#Not distributed in binary package
# aclocal.m4: FSFULLR and GPLv2+ with exception
# ar-lib: GPLv2+ with exception
# autotools: GPLv3+ with exception
# compile: GPLv2+ with exception
# config.sub: GPLv3+ with exception
# depcomp: GPLv2+ with exception
# install-sh: MIT
# ltmain.sh: GPLv2+ with exception and GPLv3+ with
# exception and GPLv3+
# m4/ax_pthread.m4: GPLv3+ with exception
# m4/libtool.m4: FSFULLR and GPLv2+ with exception
# m4/ltoptions.m4: FSFULLR
# m4/ltsugar.m4: FSFULLR
# m4/ltversion.m4: FSFULLR
# m4/lt~obsolete.m4: FSFULLR
# m4/pcre2_visibility.m4: FSFULLR
# missing: GPLv2+ with exception
# test-driver: GPLv2+ with exception
# testdata: Public Domain
License: BSD
URL: http://www.pcre.org/
Source: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/%{?rcversion:Testing/}%{name}-%{myversion}.tar.bz2
# Do no set RPATH if libdir is not /usr/lib
Patch0: pcre2-10.10-Fix-multilib.patch
# Fix matching characters above 255 when a negative character type was used
# without enabled UCP in a positive class, in upstream after 10.22,
# upstream bug #1866
Patch1: pcre2-10.22-Fix-bug-that-caused-chars-255-not-to-be-matched-by-c.patch
# Fix displaying a callout position in pcretest output with an escape sequence
# greater than \x{ff}, in upstream after 10.22
Patch2: pcre2-10.22-Fix-callout-display-bug-in-pcre2test.patch
# 1/2 Fix pcrepattern(3) documentation, un upstream after 10.22
Patch3: pcre2-10.22-Fix-typos-in-documentation.patch
# 2/2 Fix pcrepattern(3) documentation, in upstream after 10.22
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
# Fix internal option documentation in pcre2pattern(3), in upstream after 10.22,
# upstream bug #1875
Patch7: pcre2-10.22-Fix-documentation-error.patch
# Fix optimization bugs for patterns starting with lookaheads,
# in upstream after 10.22, upstream bug #1882
Patch8: pcre2-10.22-Fix-optimization-bugs-when-pattern-starts-with-looka.patch
# Document assert capture limitation, in upstream after 10.22,
# upstream bug #1887
Patch9: pcre2-10.22-Document-current-assert-capture-limitation.patch
# Ignore offset modifier in pcre2test in POSIX mode, in upstream after 10.22,
# upstream bug #1898
Patch10: pcre2-10.22-The-offset-modifier-in-pcre2test-was-not-being-ignor.patch
# Fix faulty auto-anchoring patterns when .* is inside an assertion,
# in upstream after 10.22
Patch11: pcre2-10.22-Fix-auto-anchor-bug-when-.-is-inside-an-assertion.patch
# Fix pcre2-config --libs-posix output, in upstream after 10.22,
# upstream bug #1924
Patch12: pcre2-10.22-Correct-libpcre2posix-typos-should-be-libpcre2-posix.patch
# Fix a memory leak and a typo in a documentation, in upstream after 10.22,
# upstream bug #1973
Patch13: pcre2-10.22-Fix-small-memory-leak-in-error-code-path.patch
# Fix a buffer overflow in partial match test for CRLF in an empty buffer,
# in upsteam after 10.22, upstream bug #1975
Patch14: pcre2-10.22-Fix-buffer-overflow-in-partial-match-test-for-CRLF-i.patch
# Fix a crash in pcre2test when displaying a wide character with a set locate,
# in upstream after 10.22, upstream bug #1976
Patch15: pcre2-10.22-Fix-crash-in-pcre2test-when-displaying-a-wide-charac.patch
# Fix a crash when doing an extended substitution for \p, \P, or \X,
# in upstream after 10.22, upstream bug #1977
Patch16: pcre2-10.22-Fix-NULL-defer-in-extended-substition-for-p-P-or-X.patch
# Fix a crash in substitution if starting offest was specified beyond the
# subject end, in upstream after 10.22, upstream bug #1992
Patch17: pcre2-10.22-Fix-OOB-error-in-substitute-with-start-offset-longer.patch
# Fix compiling a class with UCP and without UTF, in upstream after 10.22
Patch18: pcre2-10.22-Fix-class-bug-when-UCP-but-not-UTF-was-set-and-all-w.patch
# Fix an out-of-bound read in pcre2test tool within POSIX mode,
# in upstream after 10.22, upstream bug #2008
Patch19: pcre2-10.22-Fix-pcre2test-mishandling-end-before-start-return-wi.patch
# Fix a compiler warning, proposed to upstream but not portable before ISO C99
Patch1: pcre2-10.23-RC1-Fix-warning-on-printing-pointer-difference.patch
# New libtool to get rid of RPATH and to use distribution autotools
BuildRequires: autoconf
BuildRequires: automake
@ -156,24 +116,6 @@ Utilities demonstrating PCRE2 capabilities like pcre2grep or pcre2test.
%setup -q -n %{name}-%{myversion}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
# Because of multilib patch
libtoolize --copy --force
autoreconf -vif
@ -194,16 +136,18 @@ autoreconf -vif
--disable-bsr-anycrlf \
--disable-coverage \
--disable-ebcdic \
--disable-fuzz-support \
--disable-never-backslash-C \
--enable-newline-is-lf \
--enable-pcre2-8 \
--enable-pcre2-16 \
--enable-pcre2-32 \
--disable-pcre2test-libedit \
--enable-pcre2test-libreadline \
--enable-pcre2grep-callout \
--enable-pcre2grep-jit \
--disable-pcre2grep-libbz2 \
--disable-pcre2grep-libz \
--disable-pcre2test-libedit \
--enable-pcre2test-libreadline \
--disable-rebuild-chartables \
--enable-shared \
--enable-stack-for-recursion \
@ -270,6 +214,9 @@ make %{?_smp_mflags} check VERBOSE=yes
%{_mandir}/man1/pcre2test.*
%changelog
* Tue Jan 17 2017 Petr Pisar <ppisar@redhat.com> - 10.23-0.1.RC1
- 10.23-RC1 bump
* Thu Jan 12 2017 Igor Gnatenko <ignatenko@redhat.com> - 10.22-10.1
- Rebuild for readline 7.x

View File

@ -1 +1 @@
c0c02517938ee2b0d350d53edf450664 pcre2-10.22.tar.bz2
SHA512 (pcre2-10.23-RC1.tar.bz2) = e7ab5f34bcd0b94018c4330292756d465677af69408dbfc28d8e229b638ead33edd232f7289f57a2a07138f83362e277b80b1a7703d5568700ffaa1727badcf7