aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-18 00:48:53 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-18 00:48:53 +0000
commitb4f959e150106634c75b4ca95e2f634f5b8946a6 (patch)
treeacc56c7e107f7b209f046227260e17c24523b558
parenta11e4ab27b50d9729372ad33a4a09b648171fa57 (diff)
downloadrspamd-b4f959e150106634c75b4ca95e2f634f5b8946a6.tar.gz
rspamd-b4f959e150106634c75b4ca95e2f634f5b8946a6.zip
Disable fast path of pcre as it seems to be broken
-rw-r--r--src/libutil/regexp.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/libutil/regexp.c b/src/libutil/regexp.c
index 5b3fca551..9f782472c 100644
--- a/src/libutil/regexp.c
+++ b/src/libutil/regexp.c
@@ -33,6 +33,8 @@
typedef guchar regexp_id_t[rspamd_cryptobox_HASHBYTES];
+#define DISABLE_JIT_FAST 1
+
struct rspamd_regexp_s {
gdouble exec_time;
gchar *pattern;
@@ -362,7 +364,7 @@ rspamd_regexp_search (rspamd_regexp_t *re, const gchar *text, gsize len,
{
pcre *r;
pcre_extra *ext;
-#if defined(HAVE_PCRE_JIT) && defined(HAVE_PCRE_JIT_FAST)
+#if defined(HAVE_PCRE_JIT) && defined(HAVE_PCRE_JIT_FAST) && !defined(DISABLE_JIT_FAST)
pcre_jit_stack *st = NULL;
#endif
const gchar *mt;
@@ -398,17 +400,21 @@ rspamd_regexp_search (rspamd_regexp_t *re, const gchar *text, gsize len,
if ((re->flags & RSPAMD_REGEXP_FLAG_RAW) || raw) {
r = re->raw_re;
ext = re->raw_extra;
-#if defined(HAVE_PCRE_JIT) && defined(HAVE_PCRE_JIT_FAST)
+#if defined(HAVE_PCRE_JIT) && defined(HAVE_PCRE_JIT_FAST) && !defined(DISABLE_JIT_FAST)
st = re->raw_jstack;
#endif
}
else {
r = re->re;
ext = re->extra;
-#if defined(HAVE_PCRE_JIT) && defined(HAVE_PCRE_JIT_FAST)
+#if defined(HAVE_PCRE_JIT) && defined(HAVE_PCRE_JIT_FAST) && !defined(DISABLE_JIT_FAST)
if (g_utf8_validate (mt, remain, NULL)) {
st = re->jstack;
}
+ else {
+ msg_err ("bad utf8 input for JIT re");
+ return FALSE;
+ }
#endif
}
@@ -418,7 +424,7 @@ rspamd_regexp_search (rspamd_regexp_t *re, const gchar *text, gsize len,
if (!(re->flags & RSPAMD_REGEXP_FLAG_NOOPT)) {
#ifdef HAVE_PCRE_JIT
-# ifdef HAVE_PCRE_JIT_FAST
+# if defined(HAVE_PCRE_JIT_FAST) && !defined(DISABLE_JIT_FAST)
/* XXX: flags seems to be broken with jit fast path */
g_assert (remain > 0);
g_assert (mt != NULL);