summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2019-12-22 10:49:16 +0100
committerJakub Jirutka <jakub@jirutka.cz>2019-12-22 10:50:21 +0100
commite930166a97f3ddab2c4c366c7247e6d1e253fc15 (patch)
treea1640451999fe66220c2604fc4bac780e09e8895
parent5f5ea9aa1d2e24731a2f9e4f6d0f803e02e247c3 (diff)
main/pcre2: fix bug causing rspamd segfault
Fixes #11061
-rw-r--r--main/pcre2/APKBUILD9
-rw-r--r--main/pcre2/fix-rspamd-segfault.patch34
2 files changed, 40 insertions, 3 deletions
diff --git a/main/pcre2/APKBUILD b/main/pcre2/APKBUILD
index b4684150089..e317d3702f5 100644
--- a/main/pcre2/APKBUILD
+++ b/main/pcre2/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=pcre2
pkgver=10.34
-pkgrel=0
+pkgrel=1
pkgdesc="Perl-compatible regular expression library"
url="https://pcre.org/"
arch="all"
@@ -11,7 +11,9 @@ depends_dev="libedit-dev zlib-dev"
makedepends="$depends_dev paxmark"
subpackages="$pkgname-dev $pkgname-doc $pkgname-tools
libpcre2-16:_libpcre libpcre2-32:_libpcre"
-source="https://ftp.pcre.org/pub/pcre/pcre2-$pkgver.tar.gz"
+source="https://ftp.pcre.org/pub/pcre/pcre2-$pkgver.tar.gz
+ fix-rspamd-segfault.patch
+ "
case "$CARCH" in
s390x|armhf) _enable_jit="";; # https://bugs.exim.org/show_bug.cgi?id=2468
@@ -80,4 +82,5 @@ tools() {
mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
}
-sha512sums="820b3805fc7fcf3a80dfd42ff570efc8518fe3c50f3feb720319b95316619e5b8f6601b3c9522606315aecd5558ccfc8a04a89fab9921fdfc3400dc2caf17c22 pcre2-10.34.tar.gz"
+sha512sums="820b3805fc7fcf3a80dfd42ff570efc8518fe3c50f3feb720319b95316619e5b8f6601b3c9522606315aecd5558ccfc8a04a89fab9921fdfc3400dc2caf17c22 pcre2-10.34.tar.gz
+571e89a3dc74a3e6b52fe9c8083df79a72a6430849a7ffe887fed832c8d40537554ac8ee29c42b3c1f212ad13f0326b9c5d9305d0dd889be10ed25b1cc6992b6 fix-rspamd-segfault.patch"
diff --git a/main/pcre2/fix-rspamd-segfault.patch b/main/pcre2/fix-rspamd-segfault.patch
new file mode 100644
index 00000000000..e4bd828fab9
--- /dev/null
+++ b/main/pcre2/fix-rspamd-segfault.patch
@@ -0,0 +1,34 @@
+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
+
+Patch-Source: https://lists.exim.org/lurker/message/20191207.160053.4a30f0bc.hu.html
+
+diff --git a/src/pcre2_jit_compile.c b/src/pcre2_jit_compile.c
+index f564127..304c47a 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)