*/
#include "fstring.h"
#include "str_util.h"
+#include "contrib/fastutf8/fastutf8.h"
#ifdef WITH_JEMALLOC
if (is_utf) {
while (end < str->begin + str->len) {
- if (!g_utf8_validate (p, str->len, &end)) {
+ if (rspamd_fast_utf8_validate (p, str->len) != 0) {
return rspamd_fstrhash_lc (str, FALSE);
}
while (p < end) {
#include "ref.h"
#include "util.h"
#include "rspamd.h"
+#include "contrib/fastutf8/fastutf8.h"
#ifndef WITH_PCRE2
/* Normal pcre path */
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
#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;
}