Browse Source

[Minor] Do not parse raw regexp for explicitly utf expressions

tags/1.8.2
Vsevolod Stakhov 5 years ago
parent
commit
f2a185c18a
1 changed files with 3 additions and 1 deletions
  1. 3
    1
      src/libutil/regexp.c

+ 3
- 1
src/libutil/regexp.c View File

const gchar *start = pattern, *end, *flags_str = NULL; const gchar *start = pattern, *end, *flags_str = NULL;
gchar *err_str; gchar *err_str;
rspamd_regexp_t *res; rspamd_regexp_t *res;
gboolean explicit_utf = FALSE;
PCRE_T *r; PCRE_T *r;
gchar sep = 0, *real_pattern; gchar sep = 0, *real_pattern;
#ifndef WITH_PCRE2 #ifndef WITH_PCRE2
#else #else
regexp_flags |= PCRE_FLAG(UTF); regexp_flags |= PCRE_FLAG(UTF);
#endif #endif
explicit_utf = TRUE;
break; break;
case 'O': case 'O':
/* We optimize all regexps by default */ /* We optimize all regexps by default */
if (rspamd_flags & RSPAMD_REGEXP_FLAG_RAW) { if (rspamd_flags & RSPAMD_REGEXP_FLAG_RAW) {
res->raw_re = r; res->raw_re = r;
} }
else {
else if (!explicit_utf) {
#ifndef WITH_PCRE2 #ifndef WITH_PCRE2
res->raw_re = pcre_compile (real_pattern, regexp_flags & ~PCRE_FLAG(UTF8), res->raw_re = pcre_compile (real_pattern, regexp_flags & ~PCRE_FLAG(UTF8),
(const char **)&err_str, &err_off, NULL); (const char **)&err_str, &err_off, NULL);

Loading…
Cancel
Save