From: Timo Sirainen Date: Wed, 15 Jan 2020 19:09:34 +0000 (+0200) Subject: lib-fts: Add assert to make sure uni_utf8_get_char() returns valid UTF-8 X-Git-Tag: 2.3.9.3~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=75713bd26b49805d3107f25bc8be5e9678e3489e;p=thirdparty%2Fdovecot%2Fcore.git lib-fts: Add assert to make sure uni_utf8_get_char() returns valid UTF-8 The input to lib-fts is always expected to be valid UTF-8. --- diff --git a/src/lib-fts/fts-filter-contractions.c b/src/lib-fts/fts-filter-contractions.c index 67bab47f03..11afbb98b5 100644 --- a/src/lib-fts/fts-filter-contractions.c +++ b/src/lib-fts/fts-filter-contractions.c @@ -58,6 +58,7 @@ fts_filter_contractions_filter(struct fts_filter *filter ATTR_UNUSED, if (token[pos] == '\0') break; char_size = uni_utf8_get_char(token + pos, &apostrophe); + i_assert(char_size > 0); if (IS_APOSTROPHE(apostrophe)) { pos += char_size; *_token = token + pos;