]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-mail: test-message-snippet - Test for invalid and truncated UTF-8
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 15 Jan 2020 19:38:26 +0000 (21:38 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Thu, 23 Jan 2020 18:11:14 +0000 (20:11 +0200)
src/lib-mail/test-message-snippet.c

index e2b79c7c8c68e285dc4b972064b4a7ed81c5acc0..735acbde476eaaaa1c8c5f880dcecbf28e5ee69d 100644 (file)
@@ -3,6 +3,7 @@
 #include "lib.h"
 #include "str.h"
 #include "istream.h"
+#include "unichar.h"
 #include "message-snippet.h"
 #include "test-common.h"
 
@@ -80,6 +81,16 @@ static const struct {
          "top\nposter\n>quote1\n>quote2\n",
          100,
          "top poster" },
+       { "Content-Type: text/plain; charset=utf-8\n"
+         "\n"
+         "Invalid utf8 \x80\xff\n",
+         100,
+         "Invalid utf8 "UNICODE_REPLACEMENT_CHAR_UTF8 },
+       { "Content-Type: text/plain; charset=utf-8\n"
+         "\n"
+         "Incomplete utf8 \xC3",
+         100,
+         "Incomplete utf8" },
         { "Content-Transfer-Encoding: quoted-printable\n"
           "Content-Type: text/html;\n"
           "      charset=utf-8\n"