From cbc8dff071524f3b62fb1c6052cc5d6befb1a4f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Tue, 14 May 2019 08:48:38 +0200 Subject: [PATCH] Fix a crash when \X is used without UTF mode in a JIT --- ...sh-when-X-is-used-without-UTF-in-JIT.patch | 42 +++++++++++++++++++ ...-in-previous-commit.-Fixes-JIT-non-U.patch | 34 +++++++++++++++ pcre2.spec | 9 ++++ 3 files changed, 85 insertions(+) create mode 100644 pcre2-10.33-Fix-crash-when-X-is-used-without-UTF-in-JIT.patch create mode 100644 pcre2-10.33-Forgot-this-file-in-previous-commit.-Fixes-JIT-non-U.patch diff --git a/pcre2-10.33-Fix-crash-when-X-is-used-without-UTF-in-JIT.patch b/pcre2-10.33-Fix-crash-when-X-is-used-without-UTF-in-JIT.patch new file mode 100644 index 0000000..5bc1741 --- /dev/null +++ b/pcre2-10.33-Fix-crash-when-X-is-used-without-UTF-in-JIT.patch @@ -0,0 +1,42 @@ +From 6809752eacde104d45c5e11c3c64165857200ce7 Mon Sep 17 00:00:00 2001 +From: ph10 +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 + diff --git a/pcre2-10.33-Forgot-this-file-in-previous-commit.-Fixes-JIT-non-U.patch b/pcre2-10.33-Forgot-this-file-in-previous-commit.-Fixes-JIT-non-U.patch new file mode 100644 index 0000000..1cf2393 --- /dev/null +++ b/pcre2-10.33-Forgot-this-file-in-previous-commit.-Fixes-JIT-non-U.patch @@ -0,0 +1,34 @@ +From 9987891e7a0c885a66161cc1e62f94f314281fe7 Mon Sep 17 00:00:00 2001 +From: ph10 +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ř +--- + 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 + diff --git a/pcre2.spec b/pcre2.spec index 0a16d4b..d3fc18a 100644 --- a/pcre2.spec +++ b/pcre2.spec @@ -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 # Correct a misspelling in a documentation, in upstream after 10.33 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: automake BuildRequires: coreutils @@ -131,6 +137,8 @@ Utilities demonstrating PCRE2 capabilities like pcre2grep or pcre2test. %patch0 -p1 %patch1 -p1 %patch2 -p1 +%patch3 -p1 +%patch4 -p1 # Because of multilib patch libtoolize --copy --force autoreconf -vif @@ -231,6 +239,7 @@ make %{?_smp_mflags} check VERBOSE=yes %changelog * Mon May 13 2019 Petr Pisar - 10.33-3 - 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 - 10.33-2 - Validate number of capturing parentheses