From: Vsevolod Stakhov Date: Mon, 18 Jan 2016 00:48:53 +0000 (+0000) Subject: Disable fast path of pcre as it seems to be broken X-Git-Tag: 1.1.0~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4f959e150106634c75b4ca95e2f634f5b8946a6;p=thirdparty%2Frspamd.git Disable fast path of pcre as it seems to be broken --- diff --git a/src/libutil/regexp.c b/src/libutil/regexp.c index 5b3fca5519..9f782472cf 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);