]> granicus.if.org Git - libexpat/commitdiff
Test invalid character in a hex character reference
authorRhodri James <rhodri@kynesim.co.uk>
Thu, 15 Jun 2017 12:27:37 +0000 (13:27 +0100)
committerSebastian Pipping <sebastian@pipping.org>
Sat, 22 Jul 2017 20:49:19 +0000 (22:49 +0200)
expat/tests/runtests.c

index 67312fbbac00664344935111ead1e8a20effbfc2..65d0a82c34287201e05476a65ff115d8e8e00cdd 100644 (file)
@@ -5227,6 +5227,19 @@ START_TEST(test_invalid_character_entity)
 }
 END_TEST
 
+START_TEST(test_invalid_character_entity_2)
+{
+    const char *text =
+        "<!DOCTYPE doc [\n"
+        "  <!ENTITY entity '&#xg0;'>\n"
+        "]>\n"
+        "<doc>&entity;</doc>";
+
+    expect_failure(text, XML_ERROR_INVALID_TOKEN,
+                   "Out of range character reference not faulted");
+}
+END_TEST
+
 /* Test that processing instructions are picked up by a default handler */
 START_TEST(test_pi_handled_in_default)
 {
@@ -11326,6 +11339,7 @@ make_suite(void)
     tcase_add_test(tc_basic, test_skipped_unloaded_ext_entity);
     tcase_add_test(tc_basic, test_param_entity_with_trailing_cr);
     tcase_add_test(tc_basic, test_invalid_character_entity);
+    tcase_add_test(tc_basic, test_invalid_character_entity_2);
     tcase_add_test(tc_basic, test_pi_handled_in_default);
     tcase_add_test(tc_basic, test_comment_handled_in_default);
     tcase_add_test(tc_basic, test_pi_yml);