From: Rhodri James Date: Fri, 21 Apr 2017 12:12:51 +0000 (+0100) Subject: Test missing external entity is skipped X-Git-Tag: R_2_2_3~22^2~169 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b641ecffa1fa1152ef397386561d852416da7342;p=libexpat Test missing external entity is skipped --- diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index 9f705bad..9b4e6650 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -4813,6 +4813,28 @@ START_TEST(test_standalone_internal_entity) } END_TEST +/* Test that a reference to an unknown external entity is skipped */ +START_TEST(test_skipped_external_entity) +{ + const char *text = + "\n" + "\n"; + ExtTest test_data = { + "\n" + "\n", + NULL, + NULL + }; + + XML_SetUserData(parser, &test_data); + XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetExternalEntityRefHandler(parser, external_entity_loader); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + /* * Namespaces tests. @@ -8303,6 +8325,7 @@ make_suite(void) tcase_add_test(tc_basic, test_reject_unfinished_param_in_att_value); tcase_add_test(tc_basic, test_trailing_cr_in_att_value); tcase_add_test(tc_basic, test_standalone_internal_entity); + tcase_add_test(tc_basic, test_skipped_external_entity); suite_add_tcase(s, tc_namespace); tcase_add_checked_fixture(tc_namespace,