Fix a crash in JIT when an invalid UTF-8 charater is encountered in match_invalid_utf mode
This commit is contained in:
parent
c956d6b889
commit
00b42ec03c
@ -0,0 +1,49 @@
|
|||||||
|
From 5446ab8fa22b7e685c01cbfc5a673d2c7f994c93 Mon Sep 17 00:00:00 2001
|
||||||
|
From: zherczeg <zherczeg@6239d852-aaf2-0410-a92c-79f79f948069>
|
||||||
|
Date: Thu, 20 Feb 2020 07:42:47 +0000
|
||||||
|
Subject: [PATCH] Fix a crash which occurs when the character type of an
|
||||||
|
invalid UTF character is decoded in JIT.
|
||||||
|
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@1221 6239d852-aaf2-0410-a92c-79f79f948069
|
||||||
|
Petr Písař: Ported to 10.34.
|
||||||
|
---
|
||||||
|
src/pcre2_jit_compile.c | 6 ++++++
|
||||||
|
src/pcre2_jit_test.c | 2 ++
|
||||||
|
|
||||||
|
diff --git a/src/pcre2_jit_compile.c b/src/pcre2_jit_compile.c
|
||||||
|
index 10665a8..ef29a76 100644
|
||||||
|
--- a/src/pcre2_jit_compile.c
|
||||||
|
+++ b/src/pcre2_jit_compile.c
|
||||||
|
@@ -7224,7 +7224,13 @@ cc = ccbegin;
|
||||||
|
if ((cc[-1] & XCL_NOT) != 0)
|
||||||
|
read_char(common, min, max, backtracks, READ_CHAR_UPDATE_STR_PTR);
|
||||||
|
else
|
||||||
|
+ {
|
||||||
|
+#ifdef SUPPORT_UNICODE
|
||||||
|
+ read_char(common, min, max, (needstype || needsscript) ? backtracks : NULL, 0);
|
||||||
|
+#else /* !SUPPORT_UNICODE */
|
||||||
|
read_char(common, min, max, NULL, 0);
|
||||||
|
+#endif /* SUPPORT_UNICODE */
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if ((cc[-1] & XCL_HASPROP) == 0)
|
||||||
|
{
|
||||||
|
diff --git a/src/pcre2_jit_test.c b/src/pcre2_jit_test.c
|
||||||
|
index 187e565..619e738 100644
|
||||||
|
--- a/src/pcre2_jit_test.c
|
||||||
|
+++ b/src/pcre2_jit_test.c
|
||||||
|
@@ -1965,6 +1965,8 @@ static struct invalid_utf8_regression_test_case invalid_utf8_regression_test_cas
|
||||||
|
{ PCRE2_UTF, CI, 0, 0, 0, 4, 8, { "#\xc7\x85#", NULL }, "\x80\x80#\xc7#\xc7\x85#" },
|
||||||
|
{ PCRE2_UTF, CI, 0, 0, 0, 7, 11, { "#\xc7\x85#", NULL }, "\x80\x80#\xc7\x80\x80\x80#\xc7\x85#" },
|
||||||
|
|
||||||
|
+ { PCRE2_UTF | PCRE2_UCP, CI, 0, 0, 0, -1, -1, { "[\\s]", NULL }, "\xed\xa0\x80" },
|
||||||
|
+
|
||||||
|
/* These two are not invalid UTF tests, but this infrastructure fits better for them. */
|
||||||
|
{ 0, PCRE2_JIT_COMPLETE, 0, 0, 1, -1, -1, { "\\X{2}", NULL }, "\r\n\n" },
|
||||||
|
{ 0, PCRE2_JIT_COMPLETE, 0, 0, 1, -1, -1, { "\\R{2}", NULL }, "\r\n\n" },
|
||||||
|
--
|
||||||
|
2.21.1
|
||||||
|
|
10
pcre2.spec
10
pcre2.spec
@ -9,7 +9,7 @@
|
|||||||
#%%global rcversion RC1
|
#%%global rcversion RC1
|
||||||
Name: pcre2
|
Name: pcre2
|
||||||
Version: 10.34
|
Version: 10.34
|
||||||
Release: %{?rcversion:0.}6%{?rcversion:.%rcversion}%{?dist}
|
Release: %{?rcversion:0.}7%{?rcversion:.%rcversion}%{?dist}
|
||||||
%global myversion %{version}%{?rcversion:-%rcversion}
|
%global myversion %{version}%{?rcversion:-%rcversion}
|
||||||
Summary: Perl-compatible regular expression library
|
Summary: Perl-compatible regular expression library
|
||||||
# the library: BSD with exceptions
|
# the library: BSD with exceptions
|
||||||
@ -74,6 +74,9 @@ Patch7: pcre2-10.34-Limit-function-recursion-in-pcre2_study-to-avoid-sta.pat
|
|||||||
# Fix restoring a verb chain list when exiting a JIT-compiled recursive
|
# Fix restoring a verb chain list when exiting a JIT-compiled recursive
|
||||||
# function, in upstream after 10.34
|
# function, in upstream after 10.34
|
||||||
Patch8: pcre2-10.34-Fix-control-verb-chain-restoration-issue-in-JIT.patch
|
Patch8: pcre2-10.34-Fix-control-verb-chain-restoration-issue-in-JIT.patch
|
||||||
|
# Fix a crash in JIT when an invalid UTF-8 character is encountered in
|
||||||
|
# match_invalid_utf mode, upstream bug #2529, in upstream after 10.34
|
||||||
|
Patch9: pcre2-10.34-Fix-a-crash-which-occurs-when-the-character-type-of-.patch
|
||||||
BuildRequires: autoconf
|
BuildRequires: autoconf
|
||||||
BuildRequires: automake
|
BuildRequires: automake
|
||||||
BuildRequires: coreutils
|
BuildRequires: coreutils
|
||||||
@ -160,6 +163,7 @@ Utilities demonstrating PCRE2 capabilities like pcre2grep or pcre2test.
|
|||||||
%patch6 -p1
|
%patch6 -p1
|
||||||
%patch7 -p1
|
%patch7 -p1
|
||||||
%patch8 -p1
|
%patch8 -p1
|
||||||
|
%patch9 -p1
|
||||||
# Because of multilib patch
|
# Because of multilib patch
|
||||||
libtoolize --copy --force
|
libtoolize --copy --force
|
||||||
autoreconf -vif
|
autoreconf -vif
|
||||||
@ -257,6 +261,10 @@ make %{?_smp_mflags} check VERBOSE=yes
|
|||||||
%{_mandir}/man1/pcre2test.*
|
%{_mandir}/man1/pcre2test.*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Feb 20 2020 Petr Pisar <ppisar@redhat.com> - 10.34-7
|
||||||
|
- Fix a crash in JIT when an invalid UTF-8 character is encountered in
|
||||||
|
match_invalid_utf mode (upstream bug #2529)
|
||||||
|
|
||||||
* Mon Feb 17 2020 Petr Pisar <ppisar@redhat.com> - 10.34-6
|
* Mon Feb 17 2020 Petr Pisar <ppisar@redhat.com> - 10.34-6
|
||||||
- Fix restoring a verb chain list when exiting a JIT-compiled recursive
|
- Fix restoring a verb chain list when exiting a JIT-compiled recursive
|
||||||
function
|
function
|
||||||
|
Loading…
Reference in New Issue
Block a user