Fix a crash when \X is used without UTF mode in a JIT

This commit is contained in:
Petr Písař 2019-05-14 08:48:38 +02:00
parent 7f9e9ec8d4
commit cbc8dff071
3 changed files with 85 additions and 0 deletions

View File

@ -0,0 +1,42 @@
From 6809752eacde104d45c5e11c3c64165857200ce7 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Mon, 13 May 2019 16:26:17 +0000
Subject: [PATCH 1/2] Fix crash when \X is used without UTF 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@1091 6239d852-aaf2-0410-a92c-79f79f948069
Petr Písař: Ported to 10.33.
---
testdata/testinput4 | 3 +++
testdata/testoutput4 | 4 ++++
diff --git a/testdata/testinput4 b/testdata/testinput4
index cccab0e..f3d498c 100644
--- a/testdata/testinput4
+++ b/testdata/testinput4
@@ -2480,4 +2480,7 @@
/^(?'אABC'...)(?&אABC)/utf
123123123456
+/\X*/
+ \xF3aaa\xE4\xEA\xEB\xFEa
+
# End of testinput4
diff --git a/testdata/testoutput4 b/testdata/testoutput4
index 84b8b9e..53926ed 100644
--- a/testdata/testoutput4
+++ b/testdata/testoutput4
@@ -4012,4 +4012,8 @@ No match
0: 123123
1: 123
+/\X*/
+ \xF3aaa\xE4\xEA\xEB\xFEa
+ 0: \xf3aaa\xe4\xea\xeb\xfea
+
# End of testinput4
--
2.20.1

View File

@ -0,0 +1,34 @@
From 9987891e7a0c885a66161cc1e62f94f314281fe7 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Mon, 13 May 2019 16:38:18 +0000
Subject: [PATCH 2/2] Forgot this file in previous commit. Fixes JIT non-UTF
bug.
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@1092 6239d852-aaf2-0410-a92c-79f79f948069
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
src/pcre2_jit_compile.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/pcre2_jit_compile.c b/src/pcre2_jit_compile.c
index ae0fbcf..a19ce8b 100644
--- a/src/pcre2_jit_compile.c
+++ b/src/pcre2_jit_compile.c
@@ -8571,7 +8571,10 @@ int lgb, rgb, ricount;
PCRE2_SPTR bptr;
uint32_t c;
-GETCHARINC(c, cc);
+/* Patch by PH */
+/* GETCHARINC(c, cc); */
+
+c = *cc++;
#if PCRE2_CODE_UNIT_WIDTH == 32
if (c >= 0x110000)
return NULL;
--
2.20.1

View File

@ -53,6 +53,12 @@ Patch0: pcre2-10.10-Fix-multilib.patch
Patch1: pcre2-10.33-Implement-a-check-on-the-number-of-capturing-parenth.patch Patch1: pcre2-10.33-Implement-a-check-on-the-number-of-capturing-parenth.patch
# Correct a misspelling in a documentation, in upstream after 10.33 # Correct a misspelling in a documentation, in upstream after 10.33
Patch2: pcre2-10.33-Fix-typo.patch Patch2: pcre2-10.33-Fix-typo.patch
# 1/2 Fix a crash when \X is used without UTF mode in a JIT, upstream bug #2399,
# in upstream after 10.33
Patch3: pcre2-10.33-Fix-crash-when-X-is-used-without-UTF-in-JIT.patch
# 2/2 Fix a crash when \X is used without UTF mode in a JIT, upstream bug #2399,
# in upstream after 10.33
Patch4: pcre2-10.33-Forgot-this-file-in-previous-commit.-Fixes-JIT-non-U.patch
BuildRequires: autoconf BuildRequires: autoconf
BuildRequires: automake BuildRequires: automake
BuildRequires: coreutils BuildRequires: coreutils
@ -131,6 +137,8 @@ Utilities demonstrating PCRE2 capabilities like pcre2grep or pcre2test.
%patch0 -p1 %patch0 -p1
%patch1 -p1 %patch1 -p1
%patch2 -p1 %patch2 -p1
%patch3 -p1
%patch4 -p1
# Because of multilib patch # Because of multilib patch
libtoolize --copy --force libtoolize --copy --force
autoreconf -vif autoreconf -vif
@ -231,6 +239,7 @@ make %{?_smp_mflags} check VERBOSE=yes
%changelog %changelog
* Mon May 13 2019 Petr Pisar <ppisar@redhat.com> - 10.33-3 * Mon May 13 2019 Petr Pisar <ppisar@redhat.com> - 10.33-3
- Correct a misspelling in a documentation - Correct a misspelling in a documentation
- Fix a crash when \X is used without UTF mode in a JIT (upstream bug #2399)
* Mon May 06 2019 Petr Pisar <ppisar@redhat.com> - 10.33-2 * Mon May 06 2019 Petr Pisar <ppisar@redhat.com> - 10.33-2
- Validate number of capturing parentheses - Validate number of capturing parentheses