aboutsummaryrefslogtreecommitdiffstats
path: root/main/pcre2/fix-rspamd-segfault.patch
blob: e4bd828fab900d1e5110b39552ba7d837744569c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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)