From e9e441776cc8017ffe4b5501ff35e7495961343d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Mon, 24 Sep 2018 09:17:59 +0200 Subject: [PATCH] Fix caseless matching an extended class in JIT mode --- ...-Fix-an-xclass-matching-issue-in-JIT.patch | 53 +++++++++++++++++++ pcre2.spec | 9 +++- 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 pcre2-10.32-Fix-an-xclass-matching-issue-in-JIT.patch diff --git a/pcre2-10.32-Fix-an-xclass-matching-issue-in-JIT.patch b/pcre2-10.32-Fix-an-xclass-matching-issue-in-JIT.patch new file mode 100644 index 0000000..e6cd7c5 --- /dev/null +++ b/pcre2-10.32-Fix-an-xclass-matching-issue-in-JIT.patch @@ -0,0 +1,53 @@ +From dd9e5dc97b897fdec64525560131c1ffb8d8a4d4 Mon Sep 17 00:00:00 2001 +From: zherczeg +Date: Fri, 21 Sep 2018 07:24:34 +0000 +Subject: [PATCH] Fix an xclass matching issue 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@1016 6239d852-aaf2-0410-a92c-79f79f948069 +Petr Písař: Ported to 10.32. +--- + src/pcre2_jit_compile.c | 6 +++--- + src/pcre2_jit_test.c | 1 + + +diff --git a/src/pcre2_jit_compile.c b/src/pcre2_jit_compile.c +index 2c49f1c..4e69e76 100644 +--- a/src/pcre2_jit_compile.c ++++ b/src/pcre2_jit_compile.c +@@ -7012,9 +7012,6 @@ int i, j, k, len, c; + if (!sljit_has_cpu_feature(SLJIT_HAS_CMOV)) + return FALSE; + +-if (invert) +- nclass = !nclass; +- + len = 0; + + for (i = 0; i < 32; i++) +@@ -7096,6 +7093,9 @@ if (j != 0) + } + } + ++if (invert) ++ nclass = !nclass; ++ + type = nclass ? SLJIT_NOT_EQUAL : SLJIT_EQUAL; + add_jump(compiler, backtracks, CMP(type, TMP2, 0, SLJIT_IMM, 0)); + return TRUE; +diff --git a/src/pcre2_jit_test.c b/src/pcre2_jit_test.c +index d5f4a96..10c064e 100644 +--- a/src/pcre2_jit_test.c ++++ b/src/pcre2_jit_test.c +@@ -383,6 +383,7 @@ static struct regression_test_case regression_test_cases[] = { + { MU, A, 0, 0, "[^\\x{801}-\\x{fffe}]+", "\xe0\xa0\x81#\xc3\xa9\xf0\x90\x90\x80\xe0\xa0\x80\xef\xbf\xbf\xef\xbf\xbe" }, + { MU, A, 0, 0, "[\\x{10001}-\\x{10fffe}]+", "#\xc3\xa9\xe2\xb1\xa5\xf0\x90\x80\x80\xf0\x90\x80\x81\xf4\x8f\xbf\xbe\xf4\x8f\xbf\xbf" }, + { MU, A, 0, 0, "[^\\x{10001}-\\x{10fffe}]+", "\xf0\x90\x80\x81#\xc3\xa9\xe2\xb1\xa5\xf0\x90\x80\x80\xf4\x8f\xbf\xbf\xf4\x8f\xbf\xbe" }, ++ { CMU, A, 0, 0 | F_NOMATCH, "^[\\x{0100}-\\x{017f}]", " " }, + + /* Unicode properties. */ + { MUP, A, 0, 0, "[1-5\xc3\xa9\\w]", "\xc3\xa1_" }, +-- +2.17.1 + diff --git a/pcre2.spec b/pcre2.spec index 07664b0..ea78055 100644 --- a/pcre2.spec +++ b/pcre2.spec @@ -9,7 +9,7 @@ #%%global rcversion RC1 Name: pcre2 Version: 10.32 -Release: %{?rcversion:0.}2%{?rcversion:.%rcversion}%{?dist} +Release: %{?rcversion:0.}3%{?rcversion:.%rcversion}%{?dist} %global myversion %{version}%{?rcversion:-%rcversion} Summary: Perl-compatible regular expression library # the library: BSD with exceptions @@ -53,6 +53,9 @@ Patch0: pcre2-10.10-Fix-multilib.patch # a greater than 1 fixed quantifier, upstream bug #2320, in upstream after # 10.32 Patch1: pcre2-10.32-Fix-subject-buffer-overread-in-JIT.-Found-by-Yunho-K.patch +# Fix caseless matching an extended class in JIT mode, upstream bug #2321, +# in upstream after 10.32 +Patch2: pcre2-10.32-Fix-an-xclass-matching-issue-in-JIT.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: coreutils @@ -130,6 +133,7 @@ Utilities demonstrating PCRE2 capabilities like pcre2grep or pcre2test. %setup -q -n %{name}-%{myversion} %patch0 -p1 %patch1 -p1 +%patch2 -p1 # Because of multilib patch libtoolize --copy --force autoreconf -vif @@ -232,6 +236,9 @@ make %{?_smp_mflags} check VERBOSE=yes %{_mandir}/man1/pcre2test.* %changelog +* Mon Sep 24 2018 Petr Pisar - 10.32-3 +- Fix caseless matching an extended class in JIT mode (upstream bug #2321) + * Tue Sep 18 2018 Petr Pisar - 10.32-2 - Fix a subject buffer overread in JIT when UTF is disabled and \X or \R has a greater than 1 fixed quantifier (upstream bug #2320)