1b5975d6bSopenharmony_ciFrom 6535c77b00a444750148d9d658e4d47214bb4562 Mon Sep 17 00:00:00 2001 2b5975d6bSopenharmony_ciFrom: Aleksei Rybalkin <aleksei@rybalkin.org> 3b5975d6bSopenharmony_ciDate: Mon, 25 Jul 2022 16:48:03 +0200 4b5975d6bSopenharmony_ciSubject: [PATCH] gregex: do not set match and recursion limits on match 5b5975d6bSopenharmony_ci context 6b5975d6bSopenharmony_ci 7b5975d6bSopenharmony_ciThese are not really necessary, and cause breakages (e.g. #2700). 8b5975d6bSopenharmony_cipcre2_set_recursion_limit is also deprecated. 9b5975d6bSopenharmony_ci 10b5975d6bSopenharmony_ciFixes: #2700 11b5975d6bSopenharmony_ci 12b5975d6bSopenharmony_ciConflict:NA 13b5975d6bSopenharmony_ciReference:https://gitlab.gnome.org/GNOME/glib/-/commit/6535c77b00a444750148d9d658e4d47214bb4562 14b5975d6bSopenharmony_ci 15b5975d6bSopenharmony_ci--- 16b5975d6bSopenharmony_ci glib/gregex.c | 2 -- 17b5975d6bSopenharmony_ci glib/tests/regex.c | 3 +++ 18b5975d6bSopenharmony_ci 2 files changed, 3 insertions(+), 2 deletions(-) 19b5975d6bSopenharmony_ci 20b5975d6bSopenharmony_cidiff --git a/glib/gregex.c b/glib/gregex.c 21b5975d6bSopenharmony_ciindex 6741d2479f..dd61dc4813 100644 22b5975d6bSopenharmony_ci--- a/glib/gregex.c 23b5975d6bSopenharmony_ci+++ b/glib/gregex.c 24b5975d6bSopenharmony_ci@@ -769,8 +769,6 @@ match_info_new (const GRegex *regex, 25b5975d6bSopenharmony_ci &match_info->n_subpatterns); 26b5975d6bSopenharmony_ci 27b5975d6bSopenharmony_ci match_info->match_context = pcre2_match_context_create (NULL); 28b5975d6bSopenharmony_ci- pcre2_set_match_limit (match_info->match_context, 65536); /* should be plenty */ 29b5975d6bSopenharmony_ci- pcre2_set_recursion_limit (match_info->match_context, 64); /* should be plenty */ 30b5975d6bSopenharmony_ci 31b5975d6bSopenharmony_ci if (is_dfa) 32b5975d6bSopenharmony_ci { 33b5975d6bSopenharmony_cidiff --git a/glib/tests/regex.c b/glib/tests/regex.c 34b5975d6bSopenharmony_ciindex bb1a5ff762..5839465fae 100644 35b5975d6bSopenharmony_ci--- a/glib/tests/regex.c 36b5975d6bSopenharmony_ci+++ b/glib/tests/regex.c 37b5975d6bSopenharmony_ci@@ -2493,6 +2493,9 @@ main (int argc, char *argv[]) 38b5975d6bSopenharmony_ci TEST_MATCH("[DŽ]", G_REGEX_CASELESS, 0, "dž", -1, 0, 0, TRUE); 39b5975d6bSopenharmony_ci TEST_MATCH("[DŽ]", G_REGEX_CASELESS, 0, "Dž", -1, 0, 0, TRUE); 40b5975d6bSopenharmony_ci 41b5975d6bSopenharmony_ci+ /* see https://gitlab.gnome.org/GNOME/glib/-/issues/2700 */ 42b5975d6bSopenharmony_ci+ TEST_MATCH("(\n.+)+", G_REGEX_DEFAULT, 0, "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", -1, 0, 0, TRUE); 43b5975d6bSopenharmony_ci+ 44b5975d6bSopenharmony_ci /* TEST_MATCH_NEXT#(pattern, string, string_len, start_position, ...) */ 45b5975d6bSopenharmony_ci TEST_MATCH_NEXT0("a", "x", -1, 0); 46b5975d6bSopenharmony_ci TEST_MATCH_NEXT0("a", "ax", -1, 1); 47b5975d6bSopenharmony_ci-- 48b5975d6bSopenharmony_ciGitLab 49b5975d6bSopenharmony_ci 50