]> granicus.if.org Git - libexpat/commitdiff
Test external entity with no handler
authorRhodri James <rhodri@kynesim.co.uk>
Tue, 14 Feb 2017 16:13:06 +0000 (16:13 +0000)
committerSebastian Pipping <sebastian@pipping.org>
Sun, 16 Jul 2017 16:40:05 +0000 (18:40 +0200)
expat/tests/runtests.c

index 530cef737b25a00265dfccb77a78d7dc6d1714b2..a083e7771ae8437a0ed3abdc590296aa4e23251f 100644 (file)
@@ -1022,6 +1022,20 @@ START_TEST(test_ext_entity_set_encoding)
 }
 END_TEST
 
+/* Test external entities with no handler */
+START_TEST(test_ext_entity_no_handler)
+{
+    const char *text =
+        "<!DOCTYPE doc [\n"
+        "  <!ENTITY en SYSTEM 'http://xml.libexpat.org/dummy.ent'>\n"
+        "]>\n"
+        "<doc>&en;</doc>";
+
+    XML_SetDefaultHandler(parser, dummy_default_handler);
+    run_character_check(text, "");
+}
+END_TEST
+
 /* Test UTF-8 BOM is accepted */
 static int XMLCALL
 external_entity_loader_set_bom(XML_Parser parser,
@@ -4092,6 +4106,7 @@ make_suite(void)
                    test_wfc_undeclared_entity_with_external_subset_standalone);
     tcase_add_test(tc_basic, test_wfc_no_recursive_entity_refs);
     tcase_add_test(tc_basic, test_ext_entity_set_encoding);
+    tcase_add_test(tc_basic, test_ext_entity_no_handler);
     tcase_add_test(tc_basic, test_ext_entity_set_bom);
     tcase_add_test(tc_basic, test_ext_entity_bad_encoding);
     tcase_add_test(tc_basic, test_ext_entity_invalid_parse);