From: Tsuda Kageyu Date: Tue, 31 Jan 2017 05:19:30 +0000 (+0900) Subject: Fix and add some test cases for invalid surrogate pairs. X-Git-Tag: v1.12-beta-1~66 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dd5ab2a08fc7b0120c9ff82bd945fd2bac2a059d;p=taglib Fix and add some test cases for invalid surrogate pairs. --- diff --git a/tests/test_string.cpp b/tests/test_string.cpp index 1bd29ff5..abfbd8d2 100644 --- a/tests/test_string.cpp +++ b/tests/test_string.cpp @@ -178,9 +178,14 @@ public: const String s2(v2, String::UTF8); CPPUNIT_ASSERT_EQUAL(s2.data(String::UTF16), v1); - const ByteVector v3("\xff\xfe\xb7\xdf\xce\x91\x4b\x5c"); - const String s3(v2, String::UTF16); - CPPUNIT_ASSERT(s3.isEmpty()); + const ByteVector v3("\xfe\xff\xd8\x01\x30\x42"); + CPPUNIT_ASSERT(String(v3, String::UTF16).data(String::UTF8).isEmpty()); + + const ByteVector v4("\xfe\xff\x30\x42\xdc\x01"); + CPPUNIT_ASSERT(String(v4, String::UTF16).data(String::UTF8).isEmpty()); + + const ByteVector v5("\xfe\xff\xdc\x01\xd8\x01"); + CPPUNIT_ASSERT(String(v5, String::UTF16).data(String::UTF8).isEmpty()); } void testAppendStringDetach()