aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-11-30 15:02:39 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-11-30 15:02:39 +0000
commit7fde20c6c535c8bee0ba418fb48cb93b0fe089bb (patch)
treede8419fae2415e3c9dc51f8fb259aef69ec44cce
parent34fd4ae9cfd85f58f0d18455cf929b79047d4bd7 (diff)
downloadrspamd-7fde20c6c535c8bee0ba418fb48cb93b0fe089bb.tar.gz
rspamd-7fde20c6c535c8bee0ba418fb48cb93b0fe089bb.zip
[Minor] Fix case when all words are exceptions
-rw-r--r--src/libutil/shingles.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libutil/shingles.c b/src/libutil/shingles.c
index 2e05b773f..70aa5fe78 100644
--- a/src/libutil/shingles.c
+++ b/src/libutil/shingles.c
@@ -176,6 +176,17 @@ rspamd_shingles_from_text (GArray *input,
}
}
+ if (word == NULL) {
+ /* Nothing but exceptions */
+ for (i = 0; i < RSPAMD_SHINGLE_SIZE; i ++) {
+ g_free (hashes[i]);
+ }
+
+ g_free (hashes);
+
+ return NULL;
+ }
+
row = rspamd_fstring_append (row, word->stemmed.begin,
word->stemmed.len);
}
@@ -235,6 +246,17 @@ rspamd_shingles_from_text (GArray *input,
}
}
+ if (word == NULL) {
+ /* Nothing but exceptions */
+ for (i = 0; i < RSPAMD_SHINGLE_SIZE; i ++) {
+ g_free (hashes[i]);
+ }
+
+ g_free (hashes);
+
+ return NULL;
+ }
+
/* Insert the last element to the pipe */
memcpy (&seed, keys[j], sizeof (seed));
window[j * SHINGLES_WINDOW + SHINGLES_WINDOW - 1] =