diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index 02e951ea..768902d1 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -6917,6 +6917,45 @@ START_TEST(test_alloc_realloc_nested_groups) #undef MAX_REALLOC_COUNT END_TEST +START_TEST(test_alloc_realloc_group_choice) +{ + const char *text = + "\n" + "]>\n" + "\n" + "\n" + "This is a foo\n" + "\n" + "\n"; + int i; +#define MAX_REALLOC_COUNT 10 + + for (i = 0; i < MAX_REALLOC_COUNT; i++) { + reallocation_count = i; + XML_SetElementDeclHandler(parser, dummy_element_decl_handler); + dummy_handler_flags = 0; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) != XML_STATUS_ERROR) + break; + XML_ParserReset(parser, NULL); + } + if (i == 0) + fail("Parse succeeded despite failing reallocator"); + if (i == MAX_REALLOC_COUNT) + fail("Parse failed at maximum reallocation count"); + if (dummy_handler_flags != DUMMY_ELEMENT_DECL_HANDLER_FLAG) + fail("Element handler flag not raised"); +} +#undef MAX_REALLOC_COUNT +END_TEST + START_TEST(test_standalone_parameter_entity) { const char *text = @@ -7722,6 +7761,7 @@ make_suite(void) tcase_add_test(tc_alloc, test_alloc_system_notation); tcase_add_test(tc_alloc, test_alloc_nested_groups); tcase_add_test(tc_alloc, test_alloc_realloc_nested_groups); + tcase_add_test(tc_alloc, test_alloc_realloc_group_choice); suite_add_tcase(s, tc_nsalloc); tcase_add_checked_fixture(tc_nsalloc, nsalloc_setup, nsalloc_teardown);