diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index 09fa9f48..d6040a98 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -4145,6 +4145,27 @@ START_TEST(test_invalid_tag_in_dtd) } END_TEST +/* Test entities not quite the predefined ones are not mis-recognised */ +START_TEST(test_not_predefined_entities) +{ + const char *text[] = { + "&pt;", + "&amo;", + "&quid;", + "&apod;", + NULL + }; + int i = 0; + + while (text[i] != NULL) { + expect_failure(text[i], XML_ERROR_UNDEFINED_ENTITY, + "Undefined entity not rejected"); + XML_ParserReset(parser, NULL); + i++; + } +} +END_TEST + /* Test conditional inclusion (IGNORE) */ static int XMLCALL external_entity_load_ignore(XML_Parser parser, @@ -11798,6 +11819,7 @@ make_suite(void) tcase_add_test(tc_basic, test_byte_info_at_cdata); tcase_add_test(tc_basic, test_predefined_entities); tcase_add_test(tc_basic, test_invalid_tag_in_dtd); + tcase_add_test(tc_basic, test_not_predefined_entities); tcase_add_test(tc_basic, test_ignore_section); tcase_add_test(tc_basic, test_ignore_section_utf16); tcase_add_test(tc_basic, test_bad_ignore_section);