diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-04-23 15:06:43 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-04-23 15:06:43 +0100 |
commit | a84a5dca8a38b01acecd310fa35a76971dedcfe6 (patch) | |
tree | efe18701dc6de9b0b5f00da1d2657f3e91f6fd47 /src/libutil/regexp.c | |
parent | 71160984b699c099626d694fab886edb583551fa (diff) | |
download | rspamd-a84a5dca8a38b01acecd310fa35a76971dedcfe6.tar.gz rspamd-a84a5dca8a38b01acecd310fa35a76971dedcfe6.zip |
[Fix] Fix JIT compilation for PCRE2 expressions
Diffstat (limited to 'src/libutil/regexp.c')
-rw-r--r-- | src/libutil/regexp.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/libutil/regexp.c b/src/libutil/regexp.c index 235a3c2ac..df4751d8d 100644 --- a/src/libutil/regexp.c +++ b/src/libutil/regexp.c @@ -176,20 +176,18 @@ rspamd_regexp_post_process (rspamd_regexp_t *r) } #ifdef HAVE_PCRE_JIT - if (!(r->flags & RSPAMD_REGEXP_FLAG_RAW)) { - jit_flags |= PCRE_FLAG(UTF); - } if (pcre2_jit_compile (r->re, jit_flags) < 0) { - msg_err ("jit compilation of %s is not supported", r->pattern); + msg_err ("jit compilation of %s is not supported: %d", r->pattern, jit_flags); r->flags |= RSPAMD_REGEXP_FLAG_DISABLE_JIT; } - - if (pcre2_pattern_info (r->re, PCRE2_INFO_JITSIZE, &jsz) >= 0 && jsz > 0) { - r->jstack = pcre2_jit_stack_create (32 * 1024, 512 * 1024, NULL); - } else { - msg_err ("jit compilation of %s is not supported", r->pattern); - r->flags |= RSPAMD_REGEXP_FLAG_DISABLE_JIT; + if (pcre2_pattern_info (r->re, PCRE2_INFO_JITSIZE, &jsz) >= 0 && jsz > 0) { + r->jstack = pcre2_jit_stack_create (32 * 1024, 512 * 1024, NULL); + } + else { + msg_err ("jit compilation of %s is not supported", r->pattern); + r->flags |= RSPAMD_REGEXP_FLAG_DISABLE_JIT; + } } if (r->jstack && !(r->flags & RSPAMD_REGEXP_FLAG_DISABLE_JIT)) { @@ -197,8 +195,6 @@ rspamd_regexp_post_process (rspamd_regexp_t *r) } if (r->re != r->raw_re) { - jit_flags &= ~PCRE_FLAG(UTF); - if (pcre2_jit_compile (r->raw_re, jit_flags) < 0) { msg_debug ("jit compilation of %s is not supported", r->pattern); r->flags |= RSPAMD_REGEXP_FLAG_DISABLE_JIT; |