]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-fts: Add assert to make sure uni_utf8_get_char() returns valid UTF-8
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 15 Jan 2020 19:09:34 +0000 (21:09 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2020 10:25:53 +0000 (12:25 +0200)
The input to lib-fts is always expected to be valid UTF-8.

src/lib-fts/fts-filter-contractions.c

index 67bab47f03c9e2fdb10ebc0ea697e7fff0f9a517..11afbb98b52c99b322f5cfb497e4008f77a0c399 100644 (file)
@@ -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;