diff options
author | Dirk Jagdmann <doj@cubic.org> | 2019-12-25 20:44:11 -0800 |
---|---|---|
committer | Dirk Jagdmann <doj@cubic.org> | 2019-12-25 20:44:11 -0800 |
commit | 89e6c7b841aa2c56388b8026904f7bc713a2ba9c (patch) | |
tree | 59aed46e4f4f929c0a5542aea336353b7a097491 /src/libutil | |
parent | a1410d8d5e62886dd6a51784bd96c3d844b0d072 (diff) | |
download | rspamd-89e6c7b841aa2c56388b8026904f7bc713a2ba9c.tar.gz rspamd-89e6c7b841aa2c56388b8026904f7bc713a2ba9c.zip |
fix NULL pointer use when JIT compiling a regular expression.
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/regexp.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libutil/regexp.c b/src/libutil/regexp.c index 9bef43501..f36bd04f9 100644 --- a/src/libutil/regexp.c +++ b/src/libutil/regexp.c @@ -199,7 +199,7 @@ rspamd_regexp_post_process (rspamd_regexp_t *r) pcre2_jit_stack_assign (r->mcontext, NULL, global_re_cache->jstack); } - if (r->re != r->raw_re && !(r->flags & RSPAMD_REGEXP_FLAG_DISABLE_JIT)) { + if (r->raw_re && r->re != r->raw_re && !(r->flags & RSPAMD_REGEXP_FLAG_DISABLE_JIT)) { 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; @@ -209,6 +209,7 @@ rspamd_regexp_post_process (rspamd_regexp_t *r) msg_debug ("jit compilation of raw %s is not supported", r->pattern); } else if (!(r->flags & RSPAMD_REGEXP_FLAG_DISABLE_JIT)) { + g_assert (r->raw_mcontext != NULL); pcre2_jit_stack_assign (r->raw_mcontext, NULL, global_re_cache->jstack); } } |