From 025df07b3498cb2d97b74262a1cd00d191d8924c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Mon, 9 Dec 2019 11:15:09 +0100 Subject: [PATCH] Fix a crash in pcre2_jit_compile when passing a NULL code argument --- ...y-access-of-the-fields-of-a-compiled.patch | 45 +++++++++++++++++++ pcre2.spec | 10 ++++- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 pcre2-10.34-Fix-the-too-early-access-of-the-fields-of-a-compiled.patch diff --git a/pcre2-10.34-Fix-the-too-early-access-of-the-fields-of-a-compiled.patch b/pcre2-10.34-Fix-the-too-early-access-of-the-fields-of-a-compiled.patch new file mode 100644 index 0000000..ab2627a --- /dev/null +++ b/pcre2-10.34-Fix-the-too-early-access-of-the-fields-of-a-compiled.patch @@ -0,0 +1,45 @@ +From 75e399f77b5ffd82194b461e837a32cf48a5d970 Mon Sep 17 00:00:00 2001 +From: zherczeg +Date: Sat, 7 Dec 2019 16:00:53 +0000 +Subject: [PATCH] Fix the too early access of the fields of a compiled pattern + 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@1192 6239d852-aaf2-0410-a92c-79f79f948069 +Petr Písař: Ported to 10.34. +--- + src/pcre2_jit_compile.c | 10 +++++----- + +diff --git a/src/pcre2_jit_compile.c b/src/pcre2_jit_compile.c +index 1d64536..303c68f 100644 +--- a/src/pcre2_jit_compile.c ++++ b/src/pcre2_jit_compile.c +@@ -13742,11 +13742,6 @@ pcre2_jit_compile(pcre2_code *code, uint32_t options) + { + pcre2_real_code *re = (pcre2_real_code *)code; + +-#ifdef SUPPORT_JIT +-executable_functions *functions = (executable_functions *)re->executable_jit; +-static int executable_allocator_is_working = 0; +-#endif +- + if (code == NULL) + return PCRE2_ERROR_NULL; + +@@ -13779,6 +13774,11 @@ actions are needed: + avoid compiler warnings. + */ + ++#ifdef SUPPORT_JIT ++executable_functions *functions = (executable_functions *)re->executable_jit; ++static int executable_allocator_is_working = 0; ++#endif ++ + if ((options & PCRE2_JIT_INVALID_UTF) != 0) + { + if ((re->overall_options & PCRE2_MATCH_INVALID_UTF) == 0) +-- +2.21.0 + diff --git a/pcre2.spec b/pcre2.spec index 441978b..b8a93b1 100644 --- a/pcre2.spec +++ b/pcre2.spec @@ -9,7 +9,7 @@ #%%global rcversion RC1 Name: pcre2 Version: 10.34 -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 @@ -54,6 +54,9 @@ Patch0: pcre2-10.10-Fix-multilib.patch # Fix JIT to respect NOTEMPTY options, upstream bug #2473, # in upstream after 10.34 Patch1: pcre-10.34-Use-PCRE2_MATCH_EMPTY-flag-to-detect-empty-matches-i.patch +# Fix a crash in pcre2_jit_compile when passing a NULL code argument, +# upstream bug #2487, in upsream after 10.34 +Patch2: pcre2-10.34-Fix-the-too-early-access-of-the-fields-of-a-compiled.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: coreutils @@ -133,6 +136,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 @@ -230,6 +234,10 @@ make %{?_smp_mflags} check VERBOSE=yes %{_mandir}/man1/pcre2test.* %changelog +* Mon Dec 09 2019 Petr Pisar - 10.34-3 +- Fix a crash in pcre2_jit_compile when passing a NULL code argument (upstream + bug #2487) + * Thu Nov 28 2019 Petr Pisar - 10.34-2 - Fix JIT to respect NOTEMPTY options (upstream bug #2473)