summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2014-07-11 16:10:58 -0400
committerBehdad Esfahbod <behdad@behdad.org>2014-07-11 16:22:13 -0400
commitaf2490c0959daa0fe7f32a8b3b3a3699c7fc5f48 (patch)
treed02240ab09389d83946f0928af87bba697436b8a /test
parent7323d385cc758c06671cb38239d240eb517b28bc (diff)
downloadharfbuzz-af2490c0959daa0fe7f32a8b3b3a3699c7fc5f48.tar.gz
Only accept well-formed UTF-8 sequences
Enable tests that were disabled before, and adjust one test, and add more tests.
Diffstat (limited to 'test')
-rw-r--r--test/api/test-buffer.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/api/test-buffer.c b/test/api/test-buffer.c
index 0b70cf96..1956c92c 100644
--- a/test/api/test-buffer.c
+++ b/test/api/test-buffer.c
@@ -449,11 +449,15 @@ static const utf8_validity_test_t utf8_validity_tests[] = {
{ "\x7f", -1, 1, TRUE },
{ "\xdf\xbf", -1, 2, TRUE },
{ "\xef\xbf\xbf", -1, 0, TRUE },
- { "\xf7\xbf\xbf\xbf", -1, 0, TRUE },
+ { "\xf4\x8f\xbf\xbf", -1, 0, TRUE },
+ { "\xf4\x90\xbf\xbf", -1, 0, FALSE },
+ { "\xf7\xbf\xbf\xbf", -1, 0, FALSE },
{ "\xfb\xbf\xbf\xbf\xbf", -1, 0, FALSE },
{ "\xfd\xbf\xbf\xbf\xbf\xbf", -1, 0, FALSE },
/* other boundary conditions */
{ "\xed\x9f\xbf", -1, 3, TRUE },
+ { "\xed\xa0\x80", -1, 0, FALSE },
+ { "\xed\xbf\xbf", -1, 0, FALSE },
{ "\xee\x80\x80", -1, 3, TRUE },
{ "\xef\xbf\xbd", -1, 3, TRUE },
{ "\xf4\x8f\xbf\xbf", -1, 0, TRUE },
@@ -610,8 +614,6 @@ static const utf8_validity_test_t utf8_validity_tests[] = {
/* impossible bytes */
{ "\x20\xfe\x20", -1, 1, FALSE },
{ "\x20\xff\x20", -1, 1, FALSE },
-#if 0
- /* XXX fix these, or document that we don't detect them? */
/* overlong sequences */
{ "\x20\xc0\xaf\x20", -1, 1, FALSE },
{ "\x20\xe0\x80\xaf\x20", -1, 1, FALSE },
@@ -644,6 +646,7 @@ static const utf8_validity_test_t utf8_validity_tests[] = {
{ "\x20\xed\xae\x80\xed\xbf\xbf\x20", -1, 1, FALSE },
{ "\x20\xed\xaf\xbf\xed\xb0\x80\x20", -1, 1, FALSE },
{ "\x20\xed\xaf\xbf\xed\xbf\xbf\x20", -1, 1, FALSE },
+#if 0 /* We don't consider U+FFFE / U+FFFF and similar invalid. */
{ "\x20\xef\xbf\xbe\x20", -1, 1, FALSE },
{ "\x20\xef\xbf\xbf\x20", -1, 1, FALSE },
#endif