]> granicus.if.org Git - libexpat/commitdiff
Test invalid character reference with a decimal value
authorRhodri James <rhodri@kynesim.co.uk>
Mon, 19 Jun 2017 12:56:04 +0000 (13:56 +0100)
committerSebastian Pipping <sebastian@pipping.org>
Sat, 22 Jul 2017 20:49:20 +0000 (22:49 +0200)
Previous limit test used hexed, which has a difference parse path.

expat/tests/runtests.c

index f2e0783a4ec1ec648620b5ff1100c5c62ce96d36..09fa9f48f0a5d4001ba1c2eba57fadbfa3fa0bcd 100644 (file)
@@ -5340,6 +5340,20 @@ START_TEST(test_invalid_character_entity_3)
 }
 END_TEST
 
+START_TEST(test_invalid_character_entity_4)
+{
+    const char *text =
+        "<!DOCTYPE doc [\n"
+        "  <!ENTITY entity '&#1114112;'>\n" /* = &#x110000 */
+        "]>\n"
+        "<doc>&entity;</doc>";
+
+    expect_failure(text, XML_ERROR_BAD_CHAR_REF,
+                   "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)
 {
@@ -11823,6 +11837,7 @@ make_suite(void)
     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_invalid_character_entity_3);
+    tcase_add_test(tc_basic, test_invalid_character_entity_4);
     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);