Skip to content

Commit

Permalink
[Minor] More divisions by zero
Browse files Browse the repository at this point in the history
  • Loading branch information
vstakhov committed Dec 25, 2021
1 parent ae24d39 commit 2d8c7bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/libmime/lang_detection.c
Expand Up @@ -1308,6 +1308,10 @@ rspamd_language_detector_cmp_heuristic (gconstpointer a, gconstpointer b,
gdouble adj;
gdouble proba_adjusted, probb_adjusted, freqa, freqb;

if (cbd->d->total_occurencies == 0) {
return 0;
}

freqa = ((gdouble)canda->elt->occurencies) /
(gdouble)cbd->d->total_occurencies;
freqb = ((gdouble)candb->elt->occurencies) /
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/chartable.c
Expand Up @@ -674,7 +674,7 @@ chartable_symbol_callback (struct rspamd_task *task,
ignore_diacritics = TRUE;
}

if (task->meta_words != NULL) {
if (task->meta_words != NULL && task->meta_words->len > 0) {
rspamd_stat_token_t *w;
gdouble cur_score = 0;
gsize arlen = task->meta_words->len;
Expand Down

0 comments on commit 2d8c7bf

Please sign in to comment.