aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/regexp.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-02-10 11:17:21 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-02-10 11:46:43 +0000
commitf8d2466d3a36e8418f2d306ebaaed0ef962737b0 (patch)
tree9787f302af8d168bd5c587bd4e76c7a7d6c54856 /src/libutil/regexp.c
parent9091c3739b5f99a0a29e5c7a64fc93bef83955d6 (diff)
downloadrspamd-f8d2466d3a36e8418f2d306ebaaed0ef962737b0.tar.gz
rspamd-f8d2466d3a36e8418f2d306ebaaed0ef962737b0.zip
[Minor] Eliminate g_utf8_validate
Diffstat (limited to 'src/libutil/regexp.c')
-rw-r--r--src/libutil/regexp.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libutil/regexp.c b/src/libutil/regexp.c
index b91ab819e..0216c95e8 100644
--- a/src/libutil/regexp.c
+++ b/src/libutil/regexp.c
@@ -19,6 +19,7 @@
#include "ref.h"
#include "util.h"
#include "rspamd.h"
+#include "contrib/fastutf8/fastutf8.h"
#ifndef WITH_PCRE2
/* Normal pcre path */
@@ -576,11 +577,11 @@ rspamd_regexp_search (rspamd_regexp_t *re, const gchar *text, gsize len,
r = re->re;
ext = re->extra;
#if defined(HAVE_PCRE_JIT) && defined(HAVE_PCRE_JIT_FAST) && !defined(DISABLE_JIT_FAST)
- if (g_utf8_validate (mt, remain, NULL)) {
+ if (rspamd_fast_utf8_validate (mt, remain) == 0) {
st = global_re_cache->jstack;
}
else {
- msg_err ("bad utf8 input for JIT re");
+ msg_err ("bad utf8 input for JIT re '%s'", re->pattern);
return FALSE;
}
#endif
@@ -717,8 +718,8 @@ rspamd_regexp_search (rspamd_regexp_t *re, const gchar *text, gsize len,
#ifdef HAVE_PCRE_JIT
if (!(re->flags & RSPAMD_REGEXP_FLAG_DISABLE_JIT) && can_jit) {
- if (re->re != re->raw_re && !g_utf8_validate (mt, remain, NULL)) {
- msg_err ("bad utf8 input for JIT re");
+ if (re->re != re->raw_re && rspamd_fast_utf8_validate (mt, remain) != 0) {
+ msg_err ("bad utf8 input for JIT re '%s'", re->pattern);
return FALSE;
}