10.31 bump
This commit is contained in:
parent
307adf1b9c
commit
18fa13a8d5
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,3 +10,4 @@
|
||||
/pcre2-10.30-RC1.tar.bz2
|
||||
/pcre2-10.30.tar.bz2
|
||||
/pcre2-10.31-RC1.tar.bz2
|
||||
/pcre2-10.31.tar.bz2
|
||||
|
@ -1,394 +0,0 @@
|
||||
From b70b8394e79360f92c87a169c1ba982a7e22d9d6 Mon Sep 17 00:00:00 2001
|
||||
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
|
||||
Date: Wed, 31 Jan 2018 17:53:56 +0000
|
||||
Subject: [PATCH] Fix auto-possessification bug at the end of a capturing group
|
||||
that is called recursively.
|
||||
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@912 6239d852-aaf2-0410-a92c-79f79f948069
|
||||
|
||||
Petr Písař: Ported to 10.31-RC1.
|
||||
|
||||
src/pcre2_auto_possess.c | 56 ++++++++++++++++++------
|
||||
testdata/testinput1 | 30 +++++++++++++
|
||||
testdata/testinput2 | 17 ++++++++
|
||||
testdata/testoutput1 | 64 ++++++++++++++++++++++++++++
|
||||
testdata/testoutput2 | 109 ++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
|
||||
diff --git a/src/pcre2_auto_possess.c b/src/pcre2_auto_possess.c
|
||||
index ad3543f..23275a2 100644
|
||||
--- a/src/pcre2_auto_possess.c
|
||||
+++ b/src/pcre2_auto_possess.c
|
||||
@@ -558,47 +558,73 @@ for(;;)
|
||||
continue;
|
||||
}
|
||||
|
||||
+ /* At the end of a branch, skip to the end of the group. */
|
||||
+
|
||||
if (c == OP_ALT)
|
||||
{
|
||||
do code += GET(code, 1); while (*code == OP_ALT);
|
||||
c = *code;
|
||||
}
|
||||
|
||||
+ /* Inspect the next opcode. */
|
||||
+
|
||||
switch(c)
|
||||
{
|
||||
- case OP_END:
|
||||
- case OP_KETRPOS:
|
||||
- /* TRUE only in greedy case. The non-greedy case could be replaced by
|
||||
- an OP_EXACT, but it is probably not worth it. (And note that OP_EXACT
|
||||
- uses more memory, which we cannot get at this stage.) */
|
||||
+ /* We can always possessify a greedy iterator at the end of the pattern,
|
||||
+ which is reached after skipping over the final OP_KET. A non-greedy
|
||||
+ iterator must never be possessified. */
|
||||
|
||||
+ case OP_END:
|
||||
return base_list[1] != 0;
|
||||
|
||||
+ /* When an iterator is at the end of certain kinds of group we can inspect
|
||||
+ what follows the group by skipping over the closing ket. Note that this
|
||||
+ does not apply to OP_KETRMAX or OP_KETRMIN because what follows any given
|
||||
+ iteration is variable (could be another iteration or could be the next
|
||||
+ item). As these two opcodes are not listed in the next switch, they will
|
||||
+ end up as the next code to inspect, and return FALSE by virtue of being
|
||||
+ unsupported. */
|
||||
+
|
||||
case OP_KET:
|
||||
- /* If the bracket is capturing, and referenced by an OP_RECURSE, or
|
||||
- it is an atomic sub-pattern (assert, once, etc.) the non-greedy case
|
||||
- cannot be converted to a possessive form. */
|
||||
+ case OP_KETRPOS:
|
||||
+ /* The non-greedy case cannot be converted to a possessive form. */
|
||||
|
||||
if (base_list[1] == 0) return FALSE;
|
||||
|
||||
+ /* If the bracket is capturing it might be referenced by an OP_RECURSE
|
||||
+ so its last iterator can never be possessified if the pattern contains
|
||||
+ recursions. (This could be improved by keeping a list of group numbers that
|
||||
+ are called by recursion.) */
|
||||
+
|
||||
switch(*(code - GET(code, 1)))
|
||||
{
|
||||
+ case OP_CBRA:
|
||||
+ case OP_SCBRA:
|
||||
+ case OP_CBRAPOS:
|
||||
+ case OP_SCBRAPOS:
|
||||
+ if (cb->had_recurse) return FALSE;
|
||||
+ break;
|
||||
+
|
||||
+ /* Atomic sub-patterns and assertions can always auto-possessify their
|
||||
+ last iterator. However, if the group was entered as a result of checking
|
||||
+ a previous iterator, this is not possible. */
|
||||
+
|
||||
case OP_ASSERT:
|
||||
case OP_ASSERT_NOT:
|
||||
case OP_ASSERTBACK:
|
||||
case OP_ASSERTBACK_NOT:
|
||||
case OP_ONCE:
|
||||
|
||||
- /* Atomic sub-patterns and assertions can always auto-possessify their
|
||||
- last iterator. However, if the group was entered as a result of checking
|
||||
- a previous iterator, this is not possible. */
|
||||
-
|
||||
return !entered_a_group;
|
||||
}
|
||||
|
||||
+ /* Skip over the bracket and inspect what comes next. */
|
||||
+
|
||||
code += PRIV(OP_lengths)[c];
|
||||
continue;
|
||||
|
||||
+ /* Handle cases where the next item is a group. */
|
||||
+
|
||||
case OP_ONCE:
|
||||
case OP_BRA:
|
||||
case OP_CBRA:
|
||||
@@ -637,11 +663,15 @@ for(;;)
|
||||
code += PRIV(OP_lengths)[c];
|
||||
continue;
|
||||
|
||||
+ /* The next opcode does not need special handling; fall through and use it
|
||||
+ to see if the base can be possessified. */
|
||||
+
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
- /* Check for a supported opcode, and load its properties. */
|
||||
+ /* We now have the next appropriate opcode to compare with the base. Check
|
||||
+ for a supported opcode, and load its properties. */
|
||||
|
||||
code = get_chr_property_list(code, utf, cb->fcc, list);
|
||||
if (code == NULL) return FALSE; /* Unsupported */
|
||||
diff --git a/testdata/testinput1 b/testdata/testinput1
|
||||
index 756b4af..9a9c5fd 100644
|
||||
--- a/testdata/testinput1
|
||||
+++ b/testdata/testinput1
|
||||
@@ -6159,4 +6159,34 @@ ef) x/x,mark
|
||||
/((?<=((*ACCEPT))X)\1?Y(*ACCEPT))\1/
|
||||
XYYZ
|
||||
|
||||
+/(?(DEFINE)(?<optional_a>a?)X)^(?&optional_a)a$/
|
||||
+ aa
|
||||
+ a
|
||||
+
|
||||
+/^(a?)b(?1)a/
|
||||
+ abaa
|
||||
+ aba
|
||||
+ baa
|
||||
+ ba
|
||||
+
|
||||
+/^(a?)+b(?1)a/
|
||||
+ abaa
|
||||
+ aba
|
||||
+ baa
|
||||
+ ba
|
||||
+
|
||||
+/^(a?)++b(?1)a/
|
||||
+ abaa
|
||||
+ aba
|
||||
+ baa
|
||||
+ ba
|
||||
+
|
||||
+/^(a?)+b/
|
||||
+ b
|
||||
+ ab
|
||||
+ aaab
|
||||
+
|
||||
+/(?=a+)a(a+)++b/
|
||||
+ aab
|
||||
+
|
||||
# End of testinput1
|
||||
diff --git a/testdata/testinput2 b/testdata/testinput2
|
||||
index 2c2334c..5d3a80e 100644
|
||||
--- a/testdata/testinput2
|
||||
+++ b/testdata/testinput2
|
||||
@@ -5412,4 +5412,21 @@ a)"xI
|
||||
\= Expect no match
|
||||
\na
|
||||
|
||||
+# These tests are matched in test 1 as they are Perl compatible. Here we are
|
||||
+# looking at what does and does not get auto-possessified.
|
||||
+
|
||||
+/(?(DEFINE)(?<optional_a>a?))^(?&optional_a)a$/B
|
||||
+
|
||||
+/(?(DEFINE)(?<optional_a>a?)X)^(?&optional_a)a$/B
|
||||
+
|
||||
+/^(a?)b(?1)a/B
|
||||
+
|
||||
+/^(a?)+b(?1)a/B
|
||||
+
|
||||
+/^(a?)++b(?1)a/B
|
||||
+
|
||||
+/^(a?)+b/B
|
||||
+
|
||||
+/(?=a+)a(a+)++b/B
|
||||
+
|
||||
# End of testinput2
|
||||
diff --git a/testdata/testoutput1 b/testdata/testoutput1
|
||||
index 7cf647e..9c55be9 100644
|
||||
--- a/testdata/testoutput1
|
||||
+++ b/testdata/testoutput1
|
||||
@@ -9758,4 +9758,68 @@ No match
|
||||
1: Y
|
||||
2:
|
||||
|
||||
+/(?(DEFINE)(?<optional_a>a?)X)^(?&optional_a)a$/
|
||||
+ aa
|
||||
+ 0: aa
|
||||
+ a
|
||||
+ 0: a
|
||||
+
|
||||
+/^(a?)b(?1)a/
|
||||
+ abaa
|
||||
+ 0: abaa
|
||||
+ 1: a
|
||||
+ aba
|
||||
+ 0: aba
|
||||
+ 1: a
|
||||
+ baa
|
||||
+ 0: baa
|
||||
+ 1:
|
||||
+ ba
|
||||
+ 0: ba
|
||||
+ 1:
|
||||
+
|
||||
+/^(a?)+b(?1)a/
|
||||
+ abaa
|
||||
+ 0: abaa
|
||||
+ 1:
|
||||
+ aba
|
||||
+ 0: aba
|
||||
+ 1:
|
||||
+ baa
|
||||
+ 0: baa
|
||||
+ 1:
|
||||
+ ba
|
||||
+ 0: ba
|
||||
+ 1:
|
||||
+
|
||||
+/^(a?)++b(?1)a/
|
||||
+ abaa
|
||||
+ 0: abaa
|
||||
+ 1:
|
||||
+ aba
|
||||
+ 0: aba
|
||||
+ 1:
|
||||
+ baa
|
||||
+ 0: baa
|
||||
+ 1:
|
||||
+ ba
|
||||
+ 0: ba
|
||||
+ 1:
|
||||
+
|
||||
+/^(a?)+b/
|
||||
+ b
|
||||
+ 0: b
|
||||
+ 1:
|
||||
+ ab
|
||||
+ 0: ab
|
||||
+ 1:
|
||||
+ aaab
|
||||
+ 0: aaab
|
||||
+ 1:
|
||||
+
|
||||
+/(?=a+)a(a+)++b/
|
||||
+ aab
|
||||
+ 0: aab
|
||||
+ 1: a
|
||||
+
|
||||
# End of testinput1
|
||||
diff --git a/testdata/testoutput2 b/testdata/testoutput2
|
||||
index f783320..fcaac8f 100644
|
||||
--- a/testdata/testoutput2
|
||||
+++ b/testdata/testoutput2
|
||||
@@ -12701,7 +12701,7 @@ Subject length lower bound = 5
|
||||
Ket
|
||||
a
|
||||
CBraPos 1
|
||||
- a++
|
||||
+ a+
|
||||
KetRpos
|
||||
a
|
||||
Ket
|
||||
@@ -16468,6 +16468,113 @@ No match
|
||||
\na
|
||||
No match
|
||||
|
||||
+# These tests are matched in test 1 as they are Perl compatible. Here we are
|
||||
+# looking at what does and does not get auto-possessified.
|
||||
+
|
||||
+/(?(DEFINE)(?<optional_a>a?))^(?&optional_a)a$/B
|
||||
+------------------------------------------------------------------
|
||||
+ Bra
|
||||
+ Cond
|
||||
+ Cond false
|
||||
+ CBra 1
|
||||
+ a?
|
||||
+ Ket
|
||||
+ Ket
|
||||
+ ^
|
||||
+ Recurse
|
||||
+ a
|
||||
+ $
|
||||
+ Ket
|
||||
+ End
|
||||
+------------------------------------------------------------------
|
||||
+
|
||||
+/(?(DEFINE)(?<optional_a>a?)X)^(?&optional_a)a$/B
|
||||
+------------------------------------------------------------------
|
||||
+ Bra
|
||||
+ Cond
|
||||
+ Cond false
|
||||
+ CBra 1
|
||||
+ a?
|
||||
+ Ket
|
||||
+ X
|
||||
+ Ket
|
||||
+ ^
|
||||
+ Recurse
|
||||
+ a
|
||||
+ $
|
||||
+ Ket
|
||||
+ End
|
||||
+------------------------------------------------------------------
|
||||
+
|
||||
+/^(a?)b(?1)a/B
|
||||
+------------------------------------------------------------------
|
||||
+ Bra
|
||||
+ ^
|
||||
+ CBra 1
|
||||
+ a?
|
||||
+ Ket
|
||||
+ b
|
||||
+ Recurse
|
||||
+ a
|
||||
+ Ket
|
||||
+ End
|
||||
+------------------------------------------------------------------
|
||||
+
|
||||
+/^(a?)+b(?1)a/B
|
||||
+------------------------------------------------------------------
|
||||
+ Bra
|
||||
+ ^
|
||||
+ SCBra 1
|
||||
+ a?
|
||||
+ KetRmax
|
||||
+ b
|
||||
+ Recurse
|
||||
+ a
|
||||
+ Ket
|
||||
+ End
|
||||
+------------------------------------------------------------------
|
||||
+
|
||||
+/^(a?)++b(?1)a/B
|
||||
+------------------------------------------------------------------
|
||||
+ Bra
|
||||
+ ^
|
||||
+ SCBraPos 1
|
||||
+ a?
|
||||
+ KetRpos
|
||||
+ b
|
||||
+ Recurse
|
||||
+ a
|
||||
+ Ket
|
||||
+ End
|
||||
+------------------------------------------------------------------
|
||||
+
|
||||
+/^(a?)+b/B
|
||||
+------------------------------------------------------------------
|
||||
+ Bra
|
||||
+ ^
|
||||
+ SCBra 1
|
||||
+ a?
|
||||
+ KetRmax
|
||||
+ b
|
||||
+ Ket
|
||||
+ End
|
||||
+------------------------------------------------------------------
|
||||
+
|
||||
+/(?=a+)a(a+)++b/B
|
||||
+------------------------------------------------------------------
|
||||
+ Bra
|
||||
+ Assert
|
||||
+ a++
|
||||
+ Ket
|
||||
+ a
|
||||
+ CBraPos 1
|
||||
+ a++
|
||||
+ KetRpos
|
||||
+ b
|
||||
+ Ket
|
||||
+ End
|
||||
+------------------------------------------------------------------
|
||||
+
|
||||
# End of testinput2
|
||||
Error -65: PCRE2_ERROR_BADDATA (unknown error number)
|
||||
Error -62: bad serialized data
|
||||
--
|
||||
2.13.6
|
||||
|
@ -1,76 +0,0 @@
|
||||
From e98f42ec8153d9020f2fcc347e11c65b181267a2 Mon Sep 17 00:00:00 2001
|
||||
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
|
||||
Date: Tue, 16 Jan 2018 16:50:40 +0000
|
||||
Subject: [PATCH] Increment dummy ovector size in internal structures to avoid
|
||||
spurious array bound checker warnings. This fixes oss-fuzz 5415.
|
||||
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@911 6239d852-aaf2-0410-a92c-79f79f948069
|
||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||||
---
|
||||
src/pcre2_intmodedep.h | 20 +++++++++++---------
|
||||
|
||||
diff --git a/src/pcre2_intmodedep.h b/src/pcre2_intmodedep.h
|
||||
index 3b7d18c..c4c4c3a 100644
|
||||
--- a/src/pcre2_intmodedep.h
|
||||
+++ b/src/pcre2_intmodedep.h
|
||||
@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
|
||||
|
||||
Written by Philip Hazel
|
||||
Original API code Copyright (c) 1997-2012 University of Cambridge
|
||||
- New API code Copyright (c) 2016-2017 University of Cambridge
|
||||
+ New API code Copyright (c) 2016-2018 University of Cambridge
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -640,11 +640,13 @@ typedef struct pcre2_real_code {
|
||||
uint16_t name_count; /* Number of name entries in the table */
|
||||
} pcre2_real_code;
|
||||
|
||||
-/* The real match data structure. Define ovector large so that array bound
|
||||
-checkers don't grumble. Memory for this structure is obtained by calling
|
||||
-pcre2_match_data_create(), which sets the size as the offset of ovector plus
|
||||
-pairs of elements for each capturing group. (See also the heapframe structure
|
||||
-below.) */
|
||||
+/* The real match data structure. Define ovector as large as it can ever
|
||||
+actually be so that array bound checkers don't grumble. Memory for this
|
||||
+structure is obtained by calling pcre2_match_data_create(), which sets the size
|
||||
+as the offset of ovector plus a pair of elements for each capturable string, so
|
||||
+the size varies from call to call. As the maximum number of capturing
|
||||
+subpatterns is 65535 we must allow for 65536 strings to include the overall
|
||||
+match. (See also the heapframe structure below.) */
|
||||
|
||||
typedef struct pcre2_real_match_data {
|
||||
pcre2_memctl memctl;
|
||||
@@ -657,7 +659,7 @@ typedef struct pcre2_real_match_data {
|
||||
uint16_t matchedby; /* Type of match (normal, JIT, DFA) */
|
||||
uint16_t oveccount; /* Number of pairs */
|
||||
int rc; /* The return code from the match */
|
||||
- PCRE2_SIZE ovector[10000];/* The first field */
|
||||
+ PCRE2_SIZE ovector[131072]; /* Must be last in the structure */
|
||||
} pcre2_real_match_data;
|
||||
|
||||
|
||||
@@ -804,7 +806,7 @@ typedef struct heapframe {
|
||||
runtime array bound checks don't catch references to it. However, for any
|
||||
specific call to pcre2_match() the memory allocated for each frame structure
|
||||
allows for exactly the right size ovector for the number of capturing
|
||||
- parentheses. */
|
||||
+ parentheses. (See also the comment for pcre2_real_match_data above.) */
|
||||
|
||||
PCRE2_SPTR eptr; /* MUST BE FIRST */
|
||||
PCRE2_SPTR start_match; /* Can be adjusted by \K */
|
||||
@@ -813,7 +815,7 @@ typedef struct heapframe {
|
||||
uint32_t capture_last; /* Most recent capture */
|
||||
PCRE2_SIZE last_group_offset; /* Saved offset to most recent group frame */
|
||||
PCRE2_SIZE offset_top; /* Offset after highest capture */
|
||||
- PCRE2_SIZE ovector[10000]; /* Must be last in the structure */
|
||||
+ PCRE2_SIZE ovector[131072]; /* Must be last in the structure */
|
||||
} heapframe;
|
||||
|
||||
typedef char check_heapframe_size[
|
||||
--
|
||||
2.13.6
|
||||
|
17
pcre2.spec
17
pcre2.spec
@ -6,10 +6,10 @@
|
||||
%bcond_with pcre2_enables_sealloc
|
||||
|
||||
# This is stable release:
|
||||
%global rcversion RC1
|
||||
#%%global rcversion RC1
|
||||
Name: pcre2
|
||||
Version: 10.31
|
||||
Release: %{?rcversion:0.}3%{?rcversion:.%rcversion}%{?dist}.2
|
||||
Release: %{?rcversion:0.}1%{?rcversion:.%rcversion}%{?dist}
|
||||
%global myversion %{version}%{?rcversion:-%rcversion}
|
||||
Summary: Perl-compatible regular expression library
|
||||
# the library: BSD with exceptions
|
||||
@ -48,19 +48,15 @@ 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
|
||||
# Enlarge ovector array match data structure to be large enough in all cases,
|
||||
# in upstream after 10.31-RC1, oss-fuzz #5415
|
||||
Patch1: pcre2-10.31-RC1-Increment-dummy-ovector-size-in-internal-structures-.patch
|
||||
# Fix auto-possessification at the end of a capturing group that is called,
|
||||
# recursively, in upstream after 10.31-RC1, upstream bug #2232
|
||||
Patch2: pcre2-10.31-RC1-Fix-auto-possessification-bug-at-the-end-of-a-captur.patch
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
BuildRequires: coreutils
|
||||
BuildRequires: gcc
|
||||
BuildRequires: libtool
|
||||
BuildRequires: make
|
||||
%if %{with pcre2_enables_readline}
|
||||
BuildRequires: readline-devel
|
||||
%endif
|
||||
Provides: bundled(sljit)
|
||||
|
||||
%description
|
||||
@ -128,8 +124,6 @@ Utilities demonstrating PCRE2 capabilities like pcre2grep or pcre2test.
|
||||
%prep
|
||||
%setup -q -n %{name}-%{myversion}
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
# Because of multilib patch
|
||||
libtoolize --copy --force
|
||||
autoreconf -vif
|
||||
@ -232,6 +226,9 @@ make %{?_smp_mflags} check VERBOSE=yes
|
||||
%{_mandir}/man1/pcre2test.*
|
||||
|
||||
%changelog
|
||||
* Mon Feb 12 2018 Petr Pisar <ppisar@redhat.com> - 10.31-1
|
||||
- 10.31 bump
|
||||
|
||||
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 10.31-0.3.RC1.2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (pcre2-10.31-RC1.tar.bz2) = 1eef755c775575fdea1f3d90590affb1363265995197c04f5b82b3e0f9e9f79aa7e82689815c3e3a4a7673f76be2b00cf9dc9a399ce008baeb76d08a9aa3b50f
|
||||
SHA512 (pcre2-10.31.tar.bz2) = 44d7db2513d9415dcdf6541366fea585e016f572f3e4379f6e959a38114b2337851092049ab4a1576ae8f19b9de413edbcfa62f434c77fc8470747ee5413e967
|
||||
|
Loading…
Reference in New Issue
Block a user