summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-11-26 13:50:06 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-11-26 13:50:06 +0000
commit4e3ac80a4680a10430e3ec798d9c5636bc2f2131 (patch)
treea439a98654ac5c3a09d895c5e436ac4da2cb4724
parent776405e98494e51e8dba7b2eb10bf44088c0101c (diff)
downloadrspamd-4e3ac80a4680a10430e3ec798d9c5636bc2f2131.tar.gz
rspamd-4e3ac80a4680a10430e3ec798d9c5636bc2f2131.zip
[Minor] Fix indefinite loop in language detector
-rw-r--r--src/libmime/lang_detection.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/libmime/lang_detection.c b/src/libmime/lang_detection.c
index e80a13e29..a8ad1d57c 100644
--- a/src/libmime/lang_detection.c
+++ b/src/libmime/lang_detection.c
@@ -931,12 +931,11 @@ rspamd_language_detector_random_select (GArray *ucs_tokens, guint nwords,
tok = &g_array_index (ucs_tokens, rspamd_stat_token_t, sel);
/* Filter bad tokens */
- if (tok->unicode.len >= 2) {
- if (u_isalpha (tok->unicode.begin[0]) &&
+ if (tok->unicode.len >= 2 &&
+ u_isalpha (tok->unicode.begin[0]) &&
u_isalpha (tok->unicode.begin[tok->unicode.len - 1])) {
- offsets_out[out_idx] = sel;
- break;
- }
+ offsets_out[out_idx] = sel;
+ break;
}
else {
ntries ++;