aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-10-30 15:26:49 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-10-30 15:27:12 +0000
commitf2a185c18aaba7f58bba54bd1e2481871580c792 (patch)
tree68203a7f40f400f0d41b80b1991f86fd30f3f4d8 /src/libutil
parent1253b3e710776c8f704d76947e1d2de28059c02b (diff)
downloadrspamd-f2a185c18aaba7f58bba54bd1e2481871580c792.tar.gz
rspamd-f2a185c18aaba7f58bba54bd1e2481871580c792.zip
[Minor] Do not parse raw regexp for explicitly utf expressions
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/regexp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libutil/regexp.c b/src/libutil/regexp.c
index c8f4faa4d..f0f16f423 100644
--- a/src/libutil/regexp.c
+++ b/src/libutil/regexp.c
@@ -297,6 +297,7 @@ rspamd_regexp_new (const gchar *pattern, const gchar *flags,
const gchar *start = pattern, *end, *flags_str = NULL;
gchar *err_str;
rspamd_regexp_t *res;
+ gboolean explicit_utf = FALSE;
PCRE_T *r;
gchar sep = 0, *real_pattern;
#ifndef WITH_PCRE2
@@ -383,6 +384,7 @@ rspamd_regexp_new (const gchar *pattern, const gchar *flags,
#else
regexp_flags |= PCRE_FLAG(UTF);
#endif
+ explicit_utf = TRUE;
break;
case 'O':
/* We optimize all regexps by default */
@@ -453,7 +455,7 @@ fin:
if (rspamd_flags & RSPAMD_REGEXP_FLAG_RAW) {
res->raw_re = r;
}
- else {
+ else if (!explicit_utf) {
#ifndef WITH_PCRE2
res->raw_re = pcre_compile (real_pattern, regexp_flags & ~PCRE_FLAG(UTF8),
(const char **)&err_str, &err_off, NULL);