From 2e1253414559d2649cbf5662496800061034eb49 Mon Sep 17 00:00:00 2001 From: Snild Dolkow Date: Tue, 26 Sep 2023 10:08:58 +0200 Subject: [PATCH 1/3] tests: set isFinal in test_line_number_after_parse Without this, parsing of the start or end tag may be deferred, yielding an unexpected line number. --- expat/tests/basic_tests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/expat/tests/basic_tests.c b/expat/tests/basic_tests.c index 8b47e5fe..8f85bbb7 100644 --- a/expat/tests/basic_tests.c +++ b/expat/tests/basic_tests.c @@ -596,7 +596,7 @@ START_TEST(test_line_number_after_parse) { "\n"; XML_Size lineno; - if (_XML_Parse_SINGLE_BYTES(g_parser, text, (int)strlen(text), XML_FALSE) + if (_XML_Parse_SINGLE_BYTES(g_parser, text, (int)strlen(text), XML_TRUE) == XML_STATUS_ERROR) xml_failure(g_parser); lineno = XML_GetCurrentLineNumber(g_parser); From bb3c17198072abe89885949b85f8a0f353ac41c9 Mon Sep 17 00:00:00 2001 From: Snild Dolkow Date: Tue, 26 Sep 2023 10:13:26 +0200 Subject: [PATCH 2/3] tests: set isFinal in test_reset_in_entity Without this, parsing may be deferred so that the suspending callback hasn't been called when the test checks for it. --- expat/tests/basic_tests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/expat/tests/basic_tests.c b/expat/tests/basic_tests.c index 8f85bbb7..fb1560d0 100644 --- a/expat/tests/basic_tests.c +++ b/expat/tests/basic_tests.c @@ -2325,7 +2325,7 @@ START_TEST(test_reset_in_entity) { g_resumable = XML_TRUE; XML_SetCharacterDataHandler(g_parser, clearing_aborting_character_handler); - if (_XML_Parse_SINGLE_BYTES(g_parser, text, (int)strlen(text), XML_FALSE) + if (_XML_Parse_SINGLE_BYTES(g_parser, text, (int)strlen(text), XML_TRUE) == XML_STATUS_ERROR) xml_failure(g_parser); XML_GetParsingStatus(g_parser, &status); From a5993b2d42d88e1a39124117a781a055dbb0598b Mon Sep 17 00:00:00 2001 From: Snild Dolkow Date: Tue, 26 Sep 2023 10:31:03 +0200 Subject: [PATCH 3/3] tests: Remove early comment count check in test_user_parameters Before a parse call with isFinal=XML_TRUE, there is no guarantee that all supplied data has been parsed. Removing the first comment count check removes the test's assumption of such a guarantee. --- expat/tests/basic_tests.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/expat/tests/basic_tests.c b/expat/tests/basic_tests.c index fb1560d0..ed2c8f1b 100644 --- a/expat/tests/basic_tests.c +++ b/expat/tests/basic_tests.c @@ -2668,8 +2668,6 @@ START_TEST(test_user_parameters) { if (_XML_Parse_SINGLE_BYTES(g_parser, text, (int)strlen(text), XML_FALSE) == XML_STATUS_ERROR) xml_failure(g_parser); - if (g_comment_count != 2) - fail("Comment handler not invoked enough times"); /* Ensure we can't change policy mid-parse */ if (XML_SetParamEntityParsing(g_parser, XML_PARAM_ENTITY_PARSING_NEVER)) fail("Changed param entity parsing policy while parsing");