浏览代码

[Fix] Add workaround for hex digits

tags/1.3.0
Vsevolod Stakhov 7 年前
父节点
当前提交
983bc50e41
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4
    4
      src/plugins/chartable.c

+ 4
- 4
src/plugins/chartable.c 查看文件

@@ -187,17 +187,17 @@ rspamd_chartable_process_word_utf (struct rspamd_task *task, rspamd_ftok_t *w,
uc = g_utf8_get_char (p);

if (g_unichar_isalpha (uc)) {
sc = g_unichar_get_script (uc);

if (state == got_digit) {
/* Penalize digit -> alpha translations */
if (!is_url) {
if (!is_url && sc != G_UNICODE_SCRIPT_COMMON &&
sc != G_UNICODE_SCRIPT_LATIN) {
badness += 1.0;
}
}
else if (state == got_alpha) {
/* Check script */
sc = g_unichar_get_script (uc);

if (same_script_count > 0) {
if (sc != last_sc) {
badness += 1.0 / (gdouble)same_script_count;
@@ -279,7 +279,7 @@ rspamd_chartable_process_word_ascii (struct rspamd_task *task, rspamd_ftok_t *w,

if (state == got_digit) {
/* Penalize digit -> alpha translations */
if (!is_url) {
if (!is_url && !g_ascii_isxdigit (*p)) {
badness += 1.0;
}
}

正在加载...
取消
保存