]> granicus.if.org Git - libexpat/commitdiff
Test that UTF-8 safely passes through a CDATA section.
authorRhodri James <rhodri@kynesim.co.uk>
Wed, 14 Jun 2017 17:35:02 +0000 (18:35 +0100)
committerSebastian Pipping <sebastian@pipping.org>
Sat, 22 Jul 2017 20:49:19 +0000 (22:49 +0200)
Specifically test that multi-byte characters are correctly tokenised

expat/tests/runtests.c

index e1933e53dbb4d8e36aac05d72cb64d51dba1941a..5a5a171d324d57a2472a5dbe5a7e75ad3de89471 100644 (file)
@@ -5986,6 +5986,16 @@ START_TEST(test_ext_entity_utf8_non_bom)
 }
 END_TEST
 
+/* Test that UTF-8 in a CDATA section is correctly passed through */
+START_TEST(test_utf8_in_cdata_section)
+{
+    const char *text = "<doc><![CDATA[one \xc3\xa9 two]]></doc>";
+    const XML_Char *expected = "one \xc3\xa9 two";
+
+    run_character_check(text, expected);
+}
+END_TEST
+
 /*
  * Namespaces tests.
  */
@@ -11306,6 +11316,7 @@ make_suite(void)
     tcase_add_test(tc_basic, test_ext_entity_utf16_le);
     tcase_add_test(tc_basic, test_ext_entity_utf16_unknown);
     tcase_add_test(tc_basic, test_ext_entity_utf8_non_bom);
+    tcase_add_test(tc_basic, test_utf8_in_cdata_section);
 
     suite_add_tcase(s, tc_namespace);
     tcase_add_checked_fixture(tc_namespace,